{ pkgs, lib, ... }: { programs.vim = { enable = true; plugins = with pkgs.vimPlugins; [ ale vim-nix vim-lastplace dracula-vim vim-sensible vim-commentary vim-fugitive fzf-vim YouCompleteMe asyncomplete-vim asyncomplete-lsp-vim ultisnips vim-snippets vim-lsp vim-lsp-snippets vim-lsp-ultisnips vim-lsp-settings asyncomplete-lsp-vim ]; settings = { ignorecase = true; }; extraConfig = '' nnoremap f :Files nnoremap w :w nnoremap q :q nnoremap :bnext nnoremap :bprev inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? asyncomplete#close_popup() : "\" set cmdheight=1 set relativenumber set wrap set shiftwidth=4 set tabstop=4 set termguicolors colorscheme dracula function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete setlocal signcolumn=yes if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap gd (lsp-definition) nmap gs (lsp-document-symbol-search) nmap gS (lsp-workspace-symbol-search) nmap gr (lsp-references) nmap gi (lsp-implementation) nmap gt (lsp-type-definition) nmap rn (lsp-rename) nmap [g (lsp-previous-diagnostic) nmap ]g (lsp-next-diagnostic) nmap K (lsp-hover) nnoremap lsp#scroll(+4) nnoremap lsp#scroll(-4) let g:lsp_format_sync_timeout = 1000 autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') " refer to doc to add more commands endfunction augroup lsp_install au! " call s:on_lsp_buffer_enabled only for languages that has the server registered. autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() augroup END if executable('nil') autocmd User lsp_setup call lsp#register_server({ \ 'name': 'nil', \ 'cmd': {server_info->['nil']}, \ 'whitelist': ['nix'], \ }) endif ''; }; }