{ pkgs, lib, ... }: { home.packages = with pkgs; [ astro-language-server marksman nil typescript-language-server vim-language-server ]; programs.neovim = { enable = true; defaultEditor = true; viAlias = true; vimAlias = true; extraConfig = builtins.readFile ./config.vim; plugins = with pkgs.vimPlugins; [ cmp-buffer cmp-cmdline cmp-emoji cmp-fish cmp-nvim-lsp cmp-nvim-ultisnips cmp-path { plugin = fugitive; type = "lua"; config = '' vim.api.nvim_set_keymap("n", "g", ":Git", { noremap = true, silent = true }) ''; } { plugin = fzf-vim; type = "lua"; config = '' vim.api.nvim_set_keymap('i', '', '(fzf-complete-path)', { silent = true }) vim.api.nvim_set_keymap('i', '', '(fzf-complete-word)', { silent = true }) vim.api.nvim_set_keymap('i', '', '(fzf-complete-line)', { silent = true }) vim.api.nvim_set_keymap('n', '', '(fzf-maps-n)', { silent = true }) vim.api.nvim_set_keymap('x', '', '(fzf-maps-x)', { silent = true }) vim.api.nvim_set_keymap('o', '', '(fzf-maps-o)', { silent = true }) vim.api.nvim_set_keymap('n', 'b', ':Buffers', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'o', ':Files', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'O', ':Files ~/', { noremap = true }) vim.api.nvim_set_keymap('n', 'r', ':Read', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'R', ':Read ~/', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'a', ':Ag', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'A', ':Ag ~/', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '.', ':Files ~/devel/omniflake/', { noremap = true, silent = true }) vim.api.nvim_create_user_command( 'Read', 'call fzf#run(fzf#wrap({\'sink\': \'read\', \'dir\': }))', { nargs = '?', complete = 'dir' } ) ''; } { plugin = goyo; config = '' nnoremap yog :Goyo nnoremap [og :Goyo 80 nnoremap ]og :Goyo! ''; } { plugin = limelight-vim; config = '' set termguicolors let g:limelight_conceal_ctermfg = 'darkgray' nnoremap yof :Limelight!! nnoremap [of :Limelight nnoremap ]of :Limelight! ''; } nabla-nvim { plugin = nvim-cmp; type = "lua"; config = builtins.readFile ./nvim-cmp.lua; } { plugin = nvim-colorizer-lua; config = "lua require 'colorizer'.setup()"; } { plugin = nvim-lspconfig; type = "lua"; config = '' vim.lsp.enable('astro') vim.lsp.enable('marksman') vim.lsp.enable('nil_ls') vim.lsp.enable('r_language_server') vim.lsp.enable('texlab') vim.lsp.enable('ts_ls') vim.lsp.enable('vimls') vim.api.nvim_del_keymap('i', '') ''; } { plugin = (nvim-treesitter.withPlugins (p: [ p.nix p.lua p.r p.typescript ])); type = "lua"; config = '' vim.api.nvim_create_autocmd('FileType', { pattern = { 'nix', 'markdown', 'lua', 'r' }, callback = function() -- Enable Tree-sitter-based folding vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()' vim.o.foldmethod = 'expr' -- Optional: configure fold behavior vim.o.foldlevel = 99 vim.o.foldlevelstart = 99 end, }) ''; } { plugin = papercolor-theme; config = '' set background=light colorscheme PaperColor ''; } typescript-vim { plugin = ultisnips; type = "lua"; config = '' vim.api.nvim_set_keymap('n', 'se', ':UltiSnipsEdit!', { noremap = true, silent = true }) ''; } vifm-vim { plugin = vim-astro; config = '' let g:astro_typescript = 'enable' ''; } vim-commentary { plugin = vim-easy-align; config = '' xmap ga (EasyAlign) nmap ga (EasyAlign) ''; } { plugin = vim-fish; } vim-nix { plugin = vim-pandoc; config = '' let g:pandoc#modules#disabled = ["completion", "command", "menu"] ''; } vim-pandoc-syntax vim-repeat { plugin = vim-slime; config = '' let g:slime_target = "tmux" let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": ":.1"} let g:slime_no_mappings = 1 let g:slime_dont_ask_default = 1 xmap s SlimeRegionSend nmap s SlimeMotionSend nmap ss SlimeLineSend nnoremap s: :SlimeSend1 ''; } vim-snippets vim-speeddating vim-surround { plugin = vim-unimpaired; config = '' nnoremap =p nnoremap =P nnoremap =s ''; } { plugin = vimwiki; config = '' let g:vimwiki_list = [ { 'path': '~/notes/', 'syntax': 'markdown', 'ext': '.md' } ] nnoremap wt nnoremap wt nmap VimwikiNextLink nmap VimwikiPrevLink let g:vimwiki_key_mappings = { 'headers': 0, 'text_objs': 0, 'lists': 0, 'lists_return': 0, 'html': 0 } ''; } ]; }; xdg.configFile."nvim" = { source = ./dotfiles; recursive = true; }; home.shellAliases.v = "nvim"; }