379 lines
9.9 KiB
Nix
379 lines
9.9 KiB
Nix
{pkgs, ...}: {
|
|
programs.nixvim = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
extraConfigLuaPre = builtins.readFile ./neovim/pre.lua;
|
|
extraConfigLuaPost = builtins.readFile ./neovim/core.lua;
|
|
colorschemes = {
|
|
onedark.enable = true;
|
|
};
|
|
plugins = {
|
|
fugitive = {
|
|
enable = true;
|
|
};
|
|
gitsigns = {
|
|
enable = true;
|
|
};
|
|
lualine = {
|
|
enable = true;
|
|
# theme = "bubbles_theme"; # Currently doesn't work
|
|
componentSeparators = {
|
|
left = "";
|
|
right = "";
|
|
};
|
|
sectionSeparators = {
|
|
left = "";
|
|
right = "";
|
|
};
|
|
sections = {
|
|
lualine_a = [
|
|
{
|
|
name = "mode";
|
|
separator = {
|
|
left = "";
|
|
};
|
|
padding = {
|
|
right = 2;
|
|
left = 0;
|
|
};
|
|
}
|
|
];
|
|
lualine_b = ["filename" "branch"];
|
|
lualine_c = ["%="];
|
|
lualine_x = [];
|
|
lualine_y = ["filetype" "progress"];
|
|
lualine_z = [
|
|
{
|
|
name = "location";
|
|
separator = {
|
|
right = "";
|
|
};
|
|
padding = {
|
|
right = 0;
|
|
left = 2;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
lsp-lines = {
|
|
enable = true;
|
|
};
|
|
lsp = {
|
|
enable = true;
|
|
preConfig = ''
|
|
'';
|
|
servers = {
|
|
bashls.enable = true;
|
|
gopls.enable = true;
|
|
jsonls.enable = true;
|
|
pyright.enable = true; # In preference to attempting to use pylyzer
|
|
nil-ls.enable = true;
|
|
rust-analyzer = let
|
|
fenix = fenix.latest.withComponents ["cargo" "rustc"];
|
|
in {
|
|
enable = true;
|
|
installCargo = false;
|
|
installRustc = false;
|
|
cargoPackage = fenix.cargo;
|
|
rustcPackage = fenix.rustc;
|
|
};
|
|
taplo.enable = true;
|
|
terraformls.enable = true;
|
|
};
|
|
};
|
|
lspkind = {
|
|
enable = true;
|
|
mode = "symbol";
|
|
cmp.enable = true;
|
|
symbolMap = {
|
|
# TODO
|
|
"Text" = "";
|
|
};
|
|
};
|
|
mini = {
|
|
enable = true;
|
|
modules = {
|
|
ai.enable = true;
|
|
align.enable = true;
|
|
animate.enable = true;
|
|
comment.enable = true;
|
|
completion.enable = true;
|
|
indentscope.enable = true;
|
|
jump.enable = true;
|
|
jump2d = {
|
|
enable = true;
|
|
mappings.start_jumping = "<leader>a";
|
|
};
|
|
splitjoin.enable = true;
|
|
surround.enable = true;
|
|
tabline.enable = true;
|
|
};
|
|
};
|
|
cmp = {
|
|
enable = true;
|
|
settings = {
|
|
# formatting = {
|
|
# format = ''
|
|
# function(entry, vim_item)
|
|
# vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind)
|
|
# vim_item.menu = ({
|
|
# buffer = "[Buffer]",
|
|
# nvim_lsp = "[LSP]",
|
|
# luasnip = "[LuaSnip]",
|
|
# nvim_lua = "[Lua]",
|
|
# latex_symbols = "[LaTeX]",
|
|
# })[entry.source.name]
|
|
# return vim_item
|
|
# end
|
|
# '';
|
|
# };
|
|
mapping = {
|
|
"<CR>" = "cmp.mapping.confirm({ select = true})";
|
|
"<C-Space>" = "cmp.mapping.complete()";
|
|
"<Tab>" = ''
|
|
cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
local entry = cmp.get_selected_entry()
|
|
if not entry then
|
|
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
|
end
|
|
cmp.confirm()
|
|
else
|
|
fallback()
|
|
end
|
|
end, {"i", "s", "c"})
|
|
'';
|
|
"<S-Tab>" = ''
|
|
cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_prev_item()
|
|
elseif luasnip.jumpable(-1) then
|
|
luasnip.jump(-1)
|
|
else
|
|
fallback()
|
|
end
|
|
end, {"i", "s", "c"})
|
|
'';
|
|
};
|
|
# sources = {
|
|
# cmdline = {
|
|
# enable = true;
|
|
# };
|
|
# emoji.enable = true;
|
|
# fuzzy_path.enable = true;
|
|
# # luasnip.enable = true;
|
|
# nvim_lsp.enable = true;
|
|
# nvim_lsp_document_symbol.enable = true;
|
|
# nvim_lsp_signature_help.enable = true;
|
|
# treesitter.enable = true;
|
|
# };
|
|
view = {
|
|
entries.name = "custom";
|
|
};
|
|
};
|
|
};
|
|
project-nvim = {
|
|
enable = true;
|
|
enableTelescope = true;
|
|
detectionMethods = ["lsp" "pattern"];
|
|
};
|
|
telescope = {
|
|
enable = true;
|
|
enabledExtensions = [
|
|
"zf-native" #TODO
|
|
"projects" #TODO
|
|
"egrepify" #TODO
|
|
];
|
|
# extraLua = {
|
|
# post = builtins.readFile ./neovim/telescope.lua;
|
|
# };
|
|
keymaps = {
|
|
"<leader>ff" = {
|
|
mode = "n";
|
|
action = "find_files";
|
|
options.desc = "Find Files";
|
|
};
|
|
"<leader>fg" = {
|
|
mode = "n";
|
|
action = "require(\"telescope\").extensions.egrepify.egrepify";
|
|
options.desc = "Live Grep";
|
|
};
|
|
"<leader>fb" = {
|
|
mode = "n";
|
|
action = "buffers";
|
|
options.desc = "Find Buffers";
|
|
};
|
|
"<leader>r" = {
|
|
mode = "n";
|
|
action = "registers";
|
|
options.desc = "View Registers";
|
|
};
|
|
"<leader>pr" = {
|
|
mode = "n";
|
|
action = "lsp_references";
|
|
options.desc = "(LSP) References";
|
|
};
|
|
"<leader>pi" = {
|
|
mode = "n";
|
|
action = "lsp_implementations";
|
|
options.desc = "(LSP) Implementations";
|
|
};
|
|
"<leader>pd" = {
|
|
mode = "n";
|
|
action = "lsp_definitions";
|
|
options.desc = "(LSP) Definitions";
|
|
};
|
|
"<leader>ps" = {
|
|
mode = "n";
|
|
action = "lsp_document_symbols";
|
|
options.desc = "(LSP) Document Symbols";
|
|
};
|
|
"<leader>pws" = {
|
|
mode = "n";
|
|
action = "lsp_workspace_symbols";
|
|
options.desc = "(LSP) Workspace Symbols";
|
|
};
|
|
"<leader>pwd" = {
|
|
mode = "n";
|
|
action = "lsp_dynamic_workspace_symbols";
|
|
options.desc = "(LSP) Dynamic Workspace Symbols";
|
|
};
|
|
};
|
|
};
|
|
treesitter = {
|
|
enable = true;
|
|
settings = {
|
|
indent = {
|
|
enable = true;
|
|
};
|
|
incremental_selection = {
|
|
enable = true;
|
|
};
|
|
};
|
|
folding = true;
|
|
};
|
|
trouble = {
|
|
enable = true;
|
|
};
|
|
ts-context-commentstring = {
|
|
enable = true;
|
|
};
|
|
# ufo = { # TODO
|
|
# enable = true;
|
|
# extraLua.pre = ''
|
|
# require('ufo').setup({ provider_selector = function(bufnr, filetype, buftype)
|
|
# return {'treesitter', 'indent' }
|
|
# end
|
|
# })
|
|
# '';
|
|
# };
|
|
# undotree = {
|
|
# enable = true;
|
|
# };
|
|
vim-bbye = {
|
|
enable = true;
|
|
};
|
|
which-key = {
|
|
enable = true;
|
|
settings.spec = [
|
|
{
|
|
__unkeyed-1 = "<leader>f";
|
|
group = "Telescope - Find";
|
|
}
|
|
{
|
|
__unkeyed-1 = "<leader>p";
|
|
group = "Telescope - LSP";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
extraPlugins =
|
|
(
|
|
with pkgs.vimPlugins; [
|
|
rainbow-delimiters-nvim
|
|
telescope-symbols-nvim
|
|
overseer-nvim
|
|
nvim-web-devicons
|
|
telescope-zf-native-nvim
|
|
vim-ReplaceWithRegister
|
|
vim-dispatch-neovim
|
|
vim-expand-region
|
|
nvim-ufo
|
|
]
|
|
)
|
|
++ (with pkgs.awesomeNeovimPlugins; [
|
|
linrongbin16-gitlinker-nvim
|
|
officer-nvim
|
|
lsp-signature-nvim
|
|
nvim-biscuits
|
|
telescope-egrepify-nvim
|
|
]);
|
|
keymaps = [
|
|
{
|
|
action = "vim.cmd.UndotreeToggle";
|
|
key = "<leader>u";
|
|
options.desc = "Toggle undotree";
|
|
mode = "n";
|
|
}
|
|
{
|
|
action = "function() vim.api.nvim_command('wincmd h') end";
|
|
key = "<leader>h";
|
|
options.desc = "Cursor - Window left";
|
|
mode = "n";
|
|
}
|
|
{
|
|
action = "function() vim.api.nvim_command('wincmd j') end";
|
|
key = "<leader>j";
|
|
options.desc = "Cursor - Window down";
|
|
mode = "n";
|
|
}
|
|
{
|
|
action = "function() vim.api.nvim_command('wincmd k') end";
|
|
key = "<leader>k";
|
|
options.desc = "Cursor - Window up";
|
|
mode = "n";
|
|
}
|
|
{
|
|
action = "function() vim.api.nvim_command('wincmd l') end";
|
|
key = "<leader>l";
|
|
options.desc = "Cursor - Window right";
|
|
mode = "n";
|
|
}
|
|
{
|
|
key = "<c-k>";
|
|
action = "'<c-u>'";
|
|
mode = "n";
|
|
}
|
|
{
|
|
key = "<c-j>";
|
|
action = "'<c-d>'";
|
|
mode = "n";
|
|
}
|
|
{
|
|
key = "<leader>n";
|
|
action = "function() vim.api.nvim_command('nohl') end";
|
|
options.desc = "nohl";
|
|
mode = "n";
|
|
}
|
|
{
|
|
action = "'<cmd>Telescope<cr>'";
|
|
key = "<leader>t";
|
|
options.desc = "Open Telescope";
|
|
mode = "n";
|
|
}
|
|
{
|
|
action = "'<c-u>'";
|
|
key = "<c-k>";
|
|
mode = "v";
|
|
}
|
|
{
|
|
key = "<c-j>";
|
|
action = "'<c-d>'";
|
|
mode = "v";
|
|
}
|
|
];
|
|
};
|
|
}
|