{pkgs, ...}: { programs.nixneovim = { enable = true; defaultEditor = true; viAlias = true; vimAlias = true; extraLuaPreConfig = builtins.readFile ./neovim/pre.lua; extraConfigLua = builtins.readFile ./neovim/core.lua; colorscheme = "onedark"; 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 = ["mode" {separator = {left = "";};} {right_padding = 2;}]; lualine_b = ["filename" "branch"]; lualine_c = ["%="]; lualine_x = []; lualine_y = ["filetype" "progress"]; lualine_z = ["location" {separator = {right = "";};} {left_padding = 2;}]; }; }; # luasnip = { # enable = true; # }; lsp-lines = { enable = true; }; lspconfig = { enable = true; preConfig = '' ''; servers = { bashls.enable = true; gopls.enable = true; jsonls.enable = true; pyright.enable = true; # In preference to attempting to use pylyzer nil.enable = true; rust-analyzer.enable = true; taplo.enable = true; terraform-ls.enable = true; }; }; lspkind = { enable = true; mode = "symbol"; }; mini = { enable = true; ai.enable = true; align.enable = true; animate.enable = true; comment.enable = true; completion.enable = true; indentscope.enable = true; jump.enable = true; jump2d = { enable = true; extraConfig = { mappings.start_jumping = "a"; }; }; splitjoin.enable = true; surround.enable = true; tabline.enable = true; }; nvim-cmp = { enable = true; 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 ''; }; mappingPresets = ["insert"]; mapping = { "" = "cmp.mapping.confirm({ select = true})"; "" = "cmp.mapping.complete()"; "" = { modes = ["i" "s" "c"]; action = '' function(fallback) local entry = cmp.get_selected_entry() if not entry then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) cmp.confirm() elseif entry then cmp.confirm() elseif luasnip.expandable() then luasnip.expand() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif check_backspace() then fallback() else fallback() end end ''; }; "" = { modes = ["i" "s" "c"]; action = '' function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end ''; }; }; snippet = { luasnip.enable = false; }; 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 = "custom"; }; }; project-nvim = { enable = true; }; telescope = { enable = true; extraLua = { post = builtins.readFile ./neovim/telescope.lua; }; }; treesitter = { enable = true; indent = true; folding = true; incrementalSelection = { enable = true; }; }; trouble = { enable = true; }; ufo = { enable = true; extraLua.pre = '' require('ufo').setup({ provider_selector = function(bufnr, filetype, buftype) return {'treesitter', 'indent' } end }) ''; }; undotree = { enable = true; }; which-key = { enable = true; groups = { normal = { "f" = "Telescope - Find"; "r" = "View registers"; "p" = "Telescope - LSP"; }; }; }; }; extraPlugins = ( with pkgs.vimPlugins; [ fuzzy-nvim nvim-ts-context-commentstring telescope-zf-native-nvim vim-ReplaceWithRegister vim-bbye vim-dispatch-neovim vim-expand-region ] ) ++ (with pkgs.vimExtraPlugins; [ rainbow-delimiters-nvim gitlinker-linrongbin16 telescope-symbols-nvim overseer-nvim officer-nvim nvim-web-devicons lsp-signature-nvim nvim-rg nvim-biscuits telescope-egrepify-nvim ]); mappings = { normal = { "u" = { action = "vim.cmd.UndotreeToggle"; desc = "Toggle undotree"; }; "h" = { action = "function() vim.api.nvim_command('wincmd h') end"; desc = "Cursor - Window left"; }; "j" = { action = "function() vim.api.nvim_command('wincmd j') end"; desc = "Cursor - Window down"; }; "k" = { action = "function() vim.api.nvim_command('wincmd k') end"; desc = "Cursor - Window up"; }; "l" = { action = "function() vim.api.nvim_command('wincmd l') end"; desc = "Cursor - Window right"; }; "" = { action = "''"; }; "" = { action = "''"; }; "n" = { action = "function() vim.api.nvim_command('nohl') end"; desc = "nohl"; }; "t" = { action = "'Telescope'"; desc = "Open Telescope"; }; }; visual = { "" = { action = "''"; }; "" = { action = "''"; }; }; }; }; }