2023-07-27 13:13:03 +02:00
|
|
|
{ pkgs, lib, inputs, config, ...}:
|
2023-08-08 08:51:20 +02:00
|
|
|
{
|
2023-07-27 13:13:03 +02:00
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
defaultEditor = true;
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
vimdiffAlias = true;
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
|
|
|
lightline-vim
|
|
|
|
vim-lightline-coc
|
2023-08-08 08:51:20 +02:00
|
|
|
|
2023-07-27 13:13:03 +02:00
|
|
|
vim-commentary
|
|
|
|
vim-fugitive
|
|
|
|
|
|
|
|
nerdtree
|
|
|
|
nerdtree-git-plugin
|
|
|
|
vim-devicons
|
2023-12-07 10:22:35 +01:00
|
|
|
telescope-nvim
|
2023-07-27 13:13:03 +02:00
|
|
|
|
|
|
|
nvim-lspconfig
|
|
|
|
copilot-vim
|
|
|
|
nvim-treesitter
|
2023-08-08 08:51:20 +02:00
|
|
|
|
|
|
|
coc-css
|
2023-08-18 19:06:07 +02:00
|
|
|
coc-go
|
|
|
|
coc-html
|
2023-08-08 08:51:20 +02:00
|
|
|
coc-json
|
2023-07-27 13:13:03 +02:00
|
|
|
coc-nvim
|
|
|
|
coc-pyright
|
|
|
|
|
|
|
|
vim-nix
|
|
|
|
];
|
|
|
|
|
2023-09-15 17:04:17 +02:00
|
|
|
withNodeJs = true;
|
|
|
|
|
2023-07-27 13:13:03 +02:00
|
|
|
extraConfig = ''
|
|
|
|
let mapleader = ','
|
2023-08-08 08:51:20 +02:00
|
|
|
set number
|
|
|
|
set shiftwidth=2
|
|
|
|
set tabstop=2
|
|
|
|
set expandtab
|
|
|
|
|
2023-07-27 13:13:03 +02:00
|
|
|
" Integrate status with lightline
|
|
|
|
let g:lightline = {
|
|
|
|
\ 'active': {
|
|
|
|
\ 'left': [[ 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]]
|
|
|
|
\ }
|
|
|
|
\ }
|
|
|
|
|
|
|
|
" register components:
|
|
|
|
call lightline#coc#register()
|
|
|
|
|
|
|
|
" 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)
|
|
|
|
|
|
|
|
" Use K to show documentation in preview window.
|
|
|
|
nnoremap <silent> K :call ShowDocumentation()<CR>
|
|
|
|
function! ShowDocumentation()
|
|
|
|
if CocAction('hasProvider', 'hover')
|
|
|
|
call CocActionAsync('doHover')
|
|
|
|
else
|
|
|
|
call feedkeys('K', 'in')
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Enable syntax folding with coc
|
|
|
|
command! -nargs=* Fold :call CocAction('fold', <f-args>)
|
|
|
|
|
|
|
|
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
|
|
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
|
|
|
|
|
|
|
" Highlight the symbol and its references when holding the cursor.
|
|
|
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
|
|
|
|
|
|
|
" Symbol renaming.
|
|
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
|
|
|
|
|
|
" Use CTRL-S for selections ranges.
|
|
|
|
" Requires 'textDocument/selectionRange' support of language server.
|
|
|
|
nmap <silent> <C-s> <Plug>(coc-range-select)
|
|
|
|
xmap <silent> <C-s> <Plug>(coc-range-select)
|
|
|
|
|
|
|
|
" Step through diagnostics
|
|
|
|
nmap <silent> <g <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> >g <Plug>(coc-diagnostic-next)
|
|
|
|
|
|
|
|
" Nerdtree-settings
|
|
|
|
" Toggle nerdtree on Ctrl+t
|
|
|
|
nmap <silent> <C-t> :NERDTreeToggle<CR>
|
|
|
|
autocmd VimEnter * NERDTree " Autostart nerdtree on vim startup
|
|
|
|
autocmd VimEnter * wincmd p " Unselect nerdtree window
|
|
|
|
" Close vim is Nerdtree is the only buffer left
|
|
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
|
|
|
|
|
|
|
" List and switch buffers on Ctrl+k
|
2023-12-07 10:22:35 +01:00
|
|
|
" nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
|
|
|
|
nnoremap <silent> <C-k> !echo "Did you mean C-a?"<CR>
|
|
|
|
|
|
|
|
" Telescope-settings
|
|
|
|
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
|
|
|
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
|
|
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
|
|
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
|
|
|
nnoremap <C-a> <cmd>Telescope buffers<cr>
|
|
|
|
nnoremap <C-s> <cmd>Telescope find_files<cr>
|
|
|
|
nnoremap <C-g> <cmd>Telescope live_grep<cr>
|
2023-07-27 13:13:03 +02:00
|
|
|
|
|
|
|
" Show trailing whitespace
|
|
|
|
highlight ExtraWhitespace ctermbg=red guibg=red
|
|
|
|
match ExtraWhitespace /\s\+$/
|
|
|
|
|
|
|
|
" Disable search highlights
|
|
|
|
map <Leader><Space> :noh<CR>
|
|
|
|
'';
|
|
|
|
};
|
2023-08-08 08:51:20 +02:00
|
|
|
}
|