2021-07-14 07:43:37 +07:00
|
|
|
{ config, pkgs, ... }: {
|
2021-05-20 14:02:49 +07:00
|
|
|
programs.neovim = {
|
|
|
|
|
enable = true;
|
|
|
|
|
viAlias = true;
|
|
|
|
|
vimAlias = true;
|
|
|
|
|
vimdiffAlias = true;
|
2021-07-05 10:40:52 +07:00
|
|
|
package = pkgs.neovim-nightly;
|
2021-05-20 14:02:49 +07:00
|
|
|
|
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
2021-09-04 22:14:10 +07:00
|
|
|
coc-css
|
|
|
|
|
coc-html
|
2021-05-20 14:02:49 +07:00
|
|
|
coc-nvim
|
2021-07-04 21:28:03 +07:00
|
|
|
coc-eslint
|
|
|
|
|
coc-json
|
|
|
|
|
coc-rust-analyzer
|
|
|
|
|
coc-tsserver
|
2021-09-04 22:14:10 +07:00
|
|
|
coc-yaml
|
2021-07-04 21:28:03 +07:00
|
|
|
|
2021-07-05 13:48:41 +07:00
|
|
|
ctrlp-vim
|
2021-07-05 15:03:57 +07:00
|
|
|
lualine-nvim
|
2021-07-04 21:28:03 +07:00
|
|
|
nerdtree
|
2021-07-05 15:03:57 +07:00
|
|
|
tokyonight-nvim
|
2021-08-19 19:13:29 +07:00
|
|
|
vim-fugitive
|
2021-05-20 14:02:49 +07:00
|
|
|
vim-nix
|
2021-05-30 22:09:45 +07:00
|
|
|
vim-repeat
|
2021-08-19 16:56:50 +07:00
|
|
|
vim-signify
|
2021-05-20 14:02:49 +07:00
|
|
|
vim-surround
|
|
|
|
|
|
2021-07-05 11:24:16 +07:00
|
|
|
(nvim-treesitter.withPlugins (p: with p; [
|
2021-08-19 00:25:06 +07:00
|
|
|
tree-sitter-comment
|
2021-09-01 15:48:11 +07:00
|
|
|
tree-sitter-c-sharp
|
2021-09-05 11:36:43 +07:00
|
|
|
pkgs.tree-sitter-glimmer
|
2021-09-04 15:08:35 +07:00
|
|
|
tree-sitter-html
|
|
|
|
|
tree-sitter-javascript
|
2021-08-12 13:36:09 +07:00
|
|
|
tree-sitter-jsdoc
|
2021-09-04 15:08:35 +07:00
|
|
|
tree-sitter-json
|
2021-09-05 15:57:23 +07:00
|
|
|
pkgs.tree-sitter-jsonc
|
2021-09-04 15:08:35 +07:00
|
|
|
tree-sitter-lua
|
2021-07-05 11:24:16 +07:00
|
|
|
tree-sitter-nix
|
2021-09-04 15:08:35 +07:00
|
|
|
tree-sitter-php
|
|
|
|
|
tree-sitter-regex
|
2021-07-11 13:54:48 +07:00
|
|
|
tree-sitter-rust
|
|
|
|
|
tree-sitter-toml
|
2021-07-05 11:24:16 +07:00
|
|
|
tree-sitter-typescript
|
2021-09-04 15:08:35 +07:00
|
|
|
tree-sitter-tsx
|
2021-07-07 08:28:21 +07:00
|
|
|
tree-sitter-yaml
|
2021-07-05 11:24:16 +07:00
|
|
|
]))
|
2021-05-20 14:02:49 +07:00
|
|
|
];
|
|
|
|
|
withNodeJs = true;
|
|
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
" configuration
|
|
|
|
|
syntax enable
|
|
|
|
|
set relativenumber number
|
2021-07-05 13:50:54 +07:00
|
|
|
set cursorline
|
2021-05-20 14:02:49 +07:00
|
|
|
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-08-19 17:46:27 +07:00
|
|
|
set updatetime=100
|
2021-07-07 08:28:21 +07:00
|
|
|
let g:yaml_recommended_style=0
|
2021-05-20 14:02:49 +07:00
|
|
|
|
2021-08-19 16:56:50 +07:00
|
|
|
" signify
|
2021-08-19 19:45:02 +07:00
|
|
|
set signcolumn=yes:3
|
2021-08-19 16:56:50 +07:00
|
|
|
let g:signify_priority = 5
|
|
|
|
|
let g:signify_sign_show_count = 0
|
|
|
|
|
let g:signify_sign_add = '┃'
|
2021-08-19 19:45:02 +07:00
|
|
|
let g:signify_sign_delete = g:signify_sign_add
|
2021-08-19 16:56:50 +07:00
|
|
|
let g:signify_sign_delete_first_line = '┏━'
|
|
|
|
|
let g:signify_sign_change = g:signify_sign_add
|
|
|
|
|
let g:signify_sign_change_delete = g:signify_sign_delete
|
|
|
|
|
|
2021-05-20 14:02:49 +07:00
|
|
|
" theming
|
2021-07-05 15:03:57 +07:00
|
|
|
let g:tokyonight_style='night'
|
|
|
|
|
colorscheme tokyonight
|
2021-05-20 14:02:49 +07:00
|
|
|
|
|
|
|
|
" 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>"
|
2021-05-20 14:02:49 +07:00
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
|
|
|
|
|
|
" various aliases
|
2021-07-07 19:52:44 +07:00
|
|
|
nnoremap <leader>rs :source $MYVIMRC<CR>
|
2021-08-19 19:45:02 +07:00
|
|
|
nnoremap <C-N> :NERDTreeToggle<CR>
|
2021-08-19 19:16:23 +07:00
|
|
|
nnoremap <C-H> <C-W>h
|
|
|
|
|
nnoremap <C-J> <C-W>j
|
|
|
|
|
nnoremap <C-K> <C-W>k
|
|
|
|
|
nnoremap <C-L> <C-W>l
|
2021-08-19 19:45:02 +07:00
|
|
|
nnoremap <C-Q> :q<CR>
|
2021-09-07 08:17:34 +07:00
|
|
|
|
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
|
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)
|
2021-09-01 19:58:13 +07:00
|
|
|
nmap <leader>ref <Plug>(coc-references)
|
2021-08-19 19:45:02 +07:00
|
|
|
nmap <leader>gd :Gdiff<CR>
|
2021-07-07 19:52:44 +07:00
|
|
|
nmap <leader>rn <Plug>(coc-rename)
|
2021-05-20 14:02:49 +07:00
|
|
|
command! -nargs=0 Sw w !doas tee % > /dev/null
|
|
|
|
|
|
|
|
|
|
" disable read-only warning
|
|
|
|
|
au BufEnter * set noro
|
|
|
|
|
|
2021-09-04 21:39:45 +07:00
|
|
|
" set filetype=html for handlebar templates
|
2021-09-05 11:36:43 +07:00
|
|
|
" au BufRead,BufNewFile *.hbs set filetype=html
|
2021-09-04 21:39:45 +07:00
|
|
|
|
2021-05-20 14:02:49 +07:00
|
|
|
" disable empty line tildes
|
|
|
|
|
set fcs=eob:\
|
2021-07-05 11:24:16 +07:00
|
|
|
|
|
|
|
|
lua <<EOF
|
2021-07-05 15:03:57 +07:00
|
|
|
require('nvim-treesitter.configs').setup {
|
2021-08-12 11:57:45 +07:00
|
|
|
highlight = { enable = true },
|
|
|
|
|
indent = { enable = false }
|
2021-07-05 11:24:16 +07:00
|
|
|
}
|
2021-07-05 15:03:57 +07:00
|
|
|
require('lualine').setup {
|
|
|
|
|
options = {
|
|
|
|
|
theme = 'tokyonight'
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-19 16:56:50 +07:00
|
|
|
|
|
|
|
|
local colors = require("tokyonight.colors").setup({})
|
|
|
|
|
|
|
|
|
|
vim.cmd("highlight SignifySignAdd guifg="..colors.green)
|
|
|
|
|
vim.cmd("highlight SignifySignChange guifg="..colors.orange)
|
|
|
|
|
vim.cmd("highlight SignifySignDelete guifg="..colors.red)
|
|
|
|
|
vim.cmd("highlight SignifySignDeleteFirstLine guifg="..colors.red)
|
|
|
|
|
vim.cmd("highlight SignifySignChangeDelete guifg="..colors.red)
|
2021-07-05 11:24:16 +07:00
|
|
|
EOF
|
2021-05-20 14:02:49 +07:00
|
|
|
'';
|
|
|
|
|
};
|
2021-06-20 12:02:08 +07:00
|
|
|
xdg.configFile."nvim/coc-settings.json".text = builtins.toJSON {
|
2021-07-04 21:28:03 +07:00
|
|
|
languageserver = {
|
|
|
|
|
nix = {
|
|
|
|
|
command = "rnix-lsp";
|
|
|
|
|
filetypes = [ "nix" ];
|
|
|
|
|
};
|
|
|
|
|
};
|
2021-07-03 13:59:02 +07:00
|
|
|
"eslint.enable" = true;
|
2021-09-01 15:48:11 +07:00
|
|
|
"omnisharp.path" = "${pkgs.omnisharp-roslyn}/bin/omnisharp";
|
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";
|
|
|
|
|
};
|
2021-05-20 14:02:49 +07:00
|
|
|
}
|