Move vim config into nix config

This commit is contained in:
Artemis Tosini 2020-11-01 23:40:21 +00:00
parent 1d0fa61447
commit 3b863f2849
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
2 changed files with 73 additions and 1 deletions

53
sets/init.vim Normal file
View file

@ -0,0 +1,53 @@
cnoremap w!! w !sudo tee > /dev/null %
set guifont=Fira\ Code:h11
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_powerline_fonts = 1
set hidden
set nobackup
set nowritebackup
set cmdheight=2
set updatetime=2
set shortmess+=c
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
command! -nargs=0 Format :call CocAction('format')
command! -nargs=? Fold :call CocAction('fold', <f-args>)

View file

@ -5,6 +5,25 @@
enable = true; enable = true;
vimAlias = true; vimAlias = true;
defaultEditor = true; defaultEditor = true;
configure.customRC = "source ~/.config/nvim/init.vim\n"; configure = {
customRC = builtins.readFile ./init.vim;
packages.default.start = with pkgs.vimPlugins; [
coc-nvim
editorconfig-vim
fzf-vim
vim-airline
vim-airline-themes
vim-clang-format
vim-fetch
vim-nftables
vim-nix
vim-sensible
vim-toml
coc-go
coc-json
coc-rust-analyzer
];
};
}; };
} }