513 lines
13 KiB
Nix
513 lines
13 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
psesPkg = inputs.powershell-es.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
in
|
|
with lib;
|
|
{
|
|
options = {
|
|
nixvim = {
|
|
enable = mkEnableOption "enable k9s";
|
|
theme = mkOption {
|
|
type = types.str;
|
|
default = "latte";
|
|
description = "Catppuccin theme variant for k9s.";
|
|
};
|
|
lsp_jobb = mkEnableOption "enable jobb lsps";
|
|
};
|
|
};
|
|
|
|
config = mkIf config.nixvim.enable {
|
|
programs.nixvim = {
|
|
enable = true;
|
|
|
|
package = inputs.neovim-nightly-overlay.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
colorschemes = {
|
|
catppuccin = {
|
|
enable = true;
|
|
settings = {
|
|
flavour = config.nixvim.theme;
|
|
integrations = {
|
|
telescope = true;
|
|
treesitter = true;
|
|
cmp = true;
|
|
lualine = { };
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
opts = {
|
|
number = true;
|
|
relativenumber = true;
|
|
signcolumn = "yes";
|
|
tabstop = 4;
|
|
shiftwidth = 4;
|
|
swapfile = false;
|
|
wrap = true;
|
|
termguicolors = true;
|
|
winborder = "rounded";
|
|
};
|
|
clipboard.register = "unnamedplus";
|
|
|
|
globals.mapleader = " ";
|
|
|
|
keymaps = [
|
|
# Telescope
|
|
{
|
|
mode = "n";
|
|
key = "<leader>f";
|
|
action = "<cmd>Telescope find_files hidden=true<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>o";
|
|
action = "<cmd>Telescope live_grep<CR>";
|
|
}
|
|
|
|
# Substitute
|
|
{
|
|
mode = "n";
|
|
key = "s";
|
|
action = "<cmd>lua require('substitute').operator()<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "ss";
|
|
action = "<cmd>lua require('substitute').line()<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "S";
|
|
action = "<cmd>lua require('substitute').eol()<CR>";
|
|
}
|
|
{
|
|
mode = "x";
|
|
key = "s";
|
|
action = "<cmd>lua require('substitute').visual()<CR>";
|
|
}
|
|
|
|
# LSP
|
|
{
|
|
mode = "n";
|
|
key = "<leader>lf";
|
|
action = "<cmd>lua vim.lsp.buf.format()<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "go";
|
|
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "gd";
|
|
action = "<C-]><CR>";
|
|
options.silent = true;
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>gg";
|
|
action = "<cmd>LazyGit<CR>";
|
|
}
|
|
|
|
# Navigation fixes for wrap
|
|
{
|
|
mode = "n";
|
|
key = "j";
|
|
action = "gj";
|
|
options.silent = true;
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "k";
|
|
action = "gk";
|
|
options.silent = true;
|
|
}
|
|
|
|
# Spell
|
|
{
|
|
mode = "n";
|
|
key = "zn";
|
|
action = "]s";
|
|
options.silent = true;
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "zN";
|
|
action = "[s";
|
|
options.silent = true;
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "zj";
|
|
action = "1z=";
|
|
options.silent = true;
|
|
}
|
|
|
|
# Buffers
|
|
{
|
|
mode = "n";
|
|
key = "<Tab>";
|
|
action = ":bnext<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<S-Tab>";
|
|
action = ":bprevious<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>c";
|
|
action = ":bdelete<CR>";
|
|
}
|
|
|
|
# Window movement
|
|
{
|
|
mode = "n";
|
|
key = "<C-k>";
|
|
action = "<cmd>wincmd k<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<C-j>";
|
|
action = "<cmd>wincmd j<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<C-h>";
|
|
action = "<cmd>wincmd h<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<C-l>";
|
|
action = "<cmd>wincmd l<CR>";
|
|
}
|
|
|
|
# Save / quit
|
|
{
|
|
mode = "n";
|
|
key = "<Space>w";
|
|
action = ":w<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<Space>q";
|
|
action = ":qa<CR>";
|
|
}
|
|
|
|
# Oil
|
|
{
|
|
mode = "n";
|
|
key = "-";
|
|
action = "<CMD>Oil<CR>";
|
|
}
|
|
{
|
|
mode = "n";
|
|
key = "<leader>h";
|
|
action = "<CMD>Oil<CR>";
|
|
}
|
|
];
|
|
|
|
plugins = {
|
|
web-devicons.enable = true;
|
|
cmp-spell.enable = true;
|
|
substitute = {
|
|
enable = true;
|
|
settings = {
|
|
highlight_substituted_text = {
|
|
timer = 750;
|
|
};
|
|
range = {
|
|
auto_apply = true;
|
|
complete_word = true;
|
|
cursor_position = "start";
|
|
prefix = "S";
|
|
};
|
|
yank_substituted_text = false;
|
|
};
|
|
};
|
|
|
|
lualine = {
|
|
enable = true;
|
|
settings = {
|
|
options.theme = {
|
|
__raw = "(function() local ok, cp = pcall(require, 'catppuccin.utils.lualine'); return ok and cp() or 'auto' end)()";
|
|
};
|
|
tabline = {
|
|
lualine_a = [ ];
|
|
lualine_b = [ ];
|
|
lualine_c = [ ];
|
|
lualine_x = [ ];
|
|
lualine_y = [ "buffers" ];
|
|
lualine_z = [ ];
|
|
|
|
};
|
|
};
|
|
};
|
|
# avante = {
|
|
# enable = true;
|
|
# settings = {
|
|
# provider = "claude-code";
|
|
# acp_providers = {
|
|
# claude-code = {
|
|
# command = "npx";
|
|
# args = [ "@zed-industries/claude-code-acp" ];
|
|
# };
|
|
# };
|
|
# };
|
|
# };
|
|
|
|
treesitter = {
|
|
enable = true;
|
|
|
|
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
|
bash
|
|
json
|
|
lua
|
|
make
|
|
markdown
|
|
helm
|
|
nix
|
|
regex
|
|
toml
|
|
vim
|
|
vimdoc
|
|
xml
|
|
yaml
|
|
];
|
|
};
|
|
oil = {
|
|
enable = true;
|
|
settings = {
|
|
default_file_explorer = true;
|
|
columns = [ "icon" ];
|
|
view_options.show_hidden = true;
|
|
win_options = {
|
|
wrap = false;
|
|
signcolumn = "no";
|
|
};
|
|
};
|
|
};
|
|
|
|
auto-session.enable = true;
|
|
|
|
comment.enable = true;
|
|
which-key.enable = true;
|
|
nvim-autopairs.enable = true;
|
|
vim-surround.enable = true;
|
|
|
|
lazygit.enable = true;
|
|
|
|
telescope = {
|
|
enable = true;
|
|
settings = {
|
|
defaults = {
|
|
mappings = {
|
|
i = {
|
|
"<CR>" = {
|
|
__raw = ''
|
|
function(prompt_bufnr)
|
|
local actions = require("telescope.actions")
|
|
local action_state = require("telescope.actions.state")
|
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
|
local selections = picker:get_multi_selection()
|
|
|
|
if vim.tbl_isempty(selections) then
|
|
actions.select_default(prompt_bufnr)
|
|
return
|
|
end
|
|
|
|
local current = action_state.get_selected_entry()
|
|
actions.close(prompt_bufnr)
|
|
|
|
local seen = {}
|
|
local first = true
|
|
|
|
local function open_entry(entry)
|
|
local path = entry and (entry.path or entry.filename or entry.value)
|
|
if not path or seen[path] then
|
|
return
|
|
end
|
|
|
|
seen[path] = true
|
|
local escaped = vim.fn.fnameescape(path)
|
|
|
|
if first then
|
|
vim.cmd("edit " .. escaped)
|
|
first = false
|
|
else
|
|
vim.cmd("tabedit " .. escaped)
|
|
end
|
|
end
|
|
|
|
open_entry(current)
|
|
for _, entry in ipairs(selections) do
|
|
open_entry(entry)
|
|
end
|
|
end
|
|
'';
|
|
};
|
|
};
|
|
n = {
|
|
"<CR>" = {
|
|
__raw = ''
|
|
function(prompt_bufnr)
|
|
local actions = require("telescope.actions")
|
|
local action_state = require("telescope.actions.state")
|
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
|
local selections = picker:get_multi_selection()
|
|
|
|
if vim.tbl_isempty(selections) then
|
|
actions.select_default(prompt_bufnr)
|
|
return
|
|
end
|
|
|
|
local current = action_state.get_selected_entry()
|
|
actions.close(prompt_bufnr)
|
|
|
|
local seen = {}
|
|
local first = true
|
|
|
|
local function open_entry(entry)
|
|
local path = entry and (entry.path or entry.filename or entry.value)
|
|
if not path or seen[path] then
|
|
return
|
|
end
|
|
|
|
seen[path] = true
|
|
local escaped = vim.fn.fnameescape(path)
|
|
|
|
if first then
|
|
vim.cmd("edit " .. escaped)
|
|
first = false
|
|
else
|
|
vim.cmd("tabedit " .. escaped)
|
|
end
|
|
end
|
|
|
|
open_entry(current)
|
|
for _, entry in ipairs(selections) do
|
|
open_entry(entry)
|
|
end
|
|
end
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
vimgrep_arguments = [
|
|
"rg"
|
|
"--color=never"
|
|
"--no-heading"
|
|
"--with-filename"
|
|
"--line-number"
|
|
"--column"
|
|
"--smart-case"
|
|
"--hidden"
|
|
"--glob"
|
|
"!.git/*"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
luasnip.enable = true;
|
|
|
|
cmp = {
|
|
enable = true;
|
|
|
|
settings = {
|
|
mapping = {
|
|
"<C-Space>" = "cmp.mapping.complete()";
|
|
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
|
"<C-e>" = "cmp.mapping.close()";
|
|
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
|
|
|
"<Up>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
|
"<Down>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
|
|
|
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
|
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
|
};
|
|
|
|
sources = [
|
|
{ name = "nvim_lsp"; }
|
|
{ name = "luasnip"; }
|
|
# { name = "spell"; }
|
|
];
|
|
};
|
|
};
|
|
lsp = {
|
|
enable = true;
|
|
servers = {
|
|
gopls.enable = true;
|
|
nixd.enable = true;
|
|
lua_ls.enable = true;
|
|
bashls.enable = true;
|
|
# htmx.enable = true;
|
|
|
|
tinymist.enable = true;
|
|
tinymist.settings.formatterMode = "typstyle";
|
|
|
|
yamlls.enable = true;
|
|
jsonls.enable = true;
|
|
ts_ls.enable = true;
|
|
helm_ls.enable = true;
|
|
ansiblels = {
|
|
enable = true;
|
|
package = pkgs.vscode-extensions.redhat.ansible;
|
|
};
|
|
jinja_lsp = {
|
|
enable = true;
|
|
package = pkgs.jinja-lsp;
|
|
filetypes = [
|
|
"j2"
|
|
"jinja"
|
|
];
|
|
};
|
|
powershell_es = {
|
|
enable = true;
|
|
package = psesPkg;
|
|
extraOptions = {
|
|
bundle_path = "${psesPkg}/share/powershell/Modules";
|
|
};
|
|
};
|
|
|
|
nginx_language_server.enable = config.nixvim.lsp_jobb;
|
|
dockerls.enable = config.nixvim.lsp_jobb;
|
|
docker_compose_language_service.enable = config.nixvim.lsp_jobb;
|
|
omnisharp.enable = config.nixvim.lsp_jobb;
|
|
};
|
|
};
|
|
};
|
|
extraPlugins = with pkgs.vimPlugins; [
|
|
plenary-nvim
|
|
];
|
|
enableMan = false;
|
|
autoCmd = [
|
|
{
|
|
event = [
|
|
"BufRead"
|
|
"BufNewFile"
|
|
];
|
|
pattern = "*.{md,typ}";
|
|
command = "setlocal spell spelllang=en,sv";
|
|
}
|
|
# {
|
|
# event = [
|
|
# "BufRead"
|
|
# "BufNewFile"
|
|
# ];
|
|
# pattern = "*.{md,typ}";
|
|
# command = "setlocal spell spelllang=en";
|
|
# }
|
|
];
|
|
};
|
|
|
|
};
|
|
}
|