flakes/modules/user/neovim.nix

108 lines
2.6 KiB
Nix
Raw Normal View History

2021-07-14 07:43:37 +07:00
{ config, pkgs, ... }: {
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
2021-07-05 10:40:52 +07:00
package = pkgs.neovim-nightly;
plugins = with pkgs.vimPlugins; [
coc-nvim
coc-eslint
coc-json
coc-rust-analyzer
coc-tsserver
2021-07-05 13:48:41 +07:00
ctrlp-vim
lualine-nvim
nerdtree
tokyonight-nvim
vim-nix
2021-05-30 22:09:45 +07:00
vim-repeat
vim-surround
(nvim-treesitter.withPlugins (p: with p; [
2021-07-07 08:28:21 +07:00
tree-sitter-javascript
tree-sitter-nix
2021-07-11 13:54:48 +07:00
tree-sitter-rust
tree-sitter-toml
tree-sitter-typescript
2021-07-07 08:28:21 +07:00
tree-sitter-yaml
]))
];
withNodeJs = true;
extraConfig = ''
" configuration
syntax enable
set relativenumber number
2021-07-05 13:50:54 +07:00
set cursorline
set noswapfile
set hlsearch
set ignorecase
set incsearch
set title
set clipboard^=unnamed
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
set expandtab
2021-07-07 08:28:21 +07:00
let g:yaml_recommended_style=0
" theming
let g:tokyonight_style='night'
colorscheme tokyonight
" using tab for trigger completion
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
2021-05-20 14:47:55 +07:00
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <silent><expr> <c-space> coc#refresh()
" various aliases
2021-07-05 13:48:41 +07:00
nnoremap <c-h> :NERDTreeToggle
2021-07-07 19:52:44 +07:00
nnoremap <leader>rs :source $MYVIMRC<CR>
nmap <leader>rn <Plug>(coc-rename)
command! -nargs=0 Sw w !doas tee % > /dev/null
" disable read-only warning
au BufEnter * set noro
" disable empty line tildes
set fcs=eob:\
lua <<EOF
require('nvim-treesitter.configs').setup {
highlight = { enable = true }
}
require('lualine').setup {
options = {
theme = 'tokyonight'
}
}
EOF
'';
};
2021-06-20 12:02:08 +07:00
xdg.configFile."nvim/coc-settings.json".text = builtins.toJSON {
languageserver = {
nix = {
command = "rnix-lsp";
filetypes = [ "nix" ];
};
};
2021-07-03 13:59:02 +07:00
"eslint.enable" = true;
"eslint.options" = {
configFile = "./.eslintrc.json";
};
2021-06-20 12:02:08 +07:00
"rust-analyzer.lens.enable" = false;
"rust-analyzer.inlayHints.enable" = false;
"rust-analyzer.serverPath" = pkgs.rust-analyzer + "/bin/rust-analyzer";
};
}