2022-09-01 19:23:12 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let cfg = config.jade.neovim;
|
|
|
|
in with lib; {
|
|
|
|
options.jade.neovim = {
|
|
|
|
enable = mkEnableOption "Enable neovim";
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home-manager.users.jade = { pkgs,... } : {
|
2022-09-02 09:22:54 +00:00
|
|
|
home.packages = with pkgs; [
|
|
|
|
rust-analyzer
|
2022-09-16 16:49:31 +00:00
|
|
|
neovide
|
2022-09-02 09:22:54 +00:00
|
|
|
];
|
2022-09-01 19:23:12 +00:00
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
2023-05-12 14:24:22 +00:00
|
|
|
defaultEditor = true;
|
2022-09-02 15:07:30 +00:00
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
vimdiffAlias = true;
|
2022-09-01 19:23:12 +00:00
|
|
|
# Plugins {{{
|
2022-09-02 15:07:30 +00:00
|
|
|
plugins = with pkgs.vimPlugins; [
|
|
|
|
nerdtree-git-plugin
|
|
|
|
ctrlp-vim
|
|
|
|
vim-devicons
|
|
|
|
vim-nix
|
|
|
|
vim-pug
|
2023-04-22 10:52:11 +00:00
|
|
|
|
|
|
|
statix
|
|
|
|
haskell-tools-nvim
|
|
|
|
|
2022-09-02 15:07:30 +00:00
|
|
|
coc-rust-analyzer
|
|
|
|
coc-git
|
|
|
|
coc-fzf
|
|
|
|
coc-css
|
|
|
|
coc-yaml
|
|
|
|
coc-json
|
|
|
|
coc-html
|
|
|
|
coc-emmet
|
|
|
|
coc-vimlsp
|
|
|
|
coc-tsserver
|
2022-09-17 13:30:46 +00:00
|
|
|
{
|
|
|
|
plugin = toggleterm-nvim;
|
|
|
|
config = ''
|
|
|
|
lua require("toggleterm").setup{}
|
|
|
|
autocmd TermEnter term://*toggleterm#*
|
|
|
|
\ tnoremap <silent><c-t> <Cmd>exe v:count1 . "ToggleTerm"<CR>
|
|
|
|
|
|
|
|
" By applying the mappings this way you can pass a count to your
|
|
|
|
" mapping to open a specific window.
|
|
|
|
" For example: 2<C-t> will open terminal 2
|
|
|
|
nnoremap <silent><c-t> <Cmd>exe v:count1 . "ToggleTerm direction=float"<CR>
|
|
|
|
inoremap <silent><c-t> <Esc><Cmd>exe v:count1 . "ToggleTerm direction=float"<CR>
|
|
|
|
'';
|
|
|
|
}
|
2022-09-02 15:07:30 +00:00
|
|
|
{
|
|
|
|
plugin = gruvbox-nvim;
|
|
|
|
config = "colorscheme gruvbox";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = nerdtree;
|
|
|
|
config = "nmap <C-n> :NERDTreeToggle<CR>";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = nerdcommenter;
|
|
|
|
config = ''
|
2022-09-17 13:30:46 +00:00
|
|
|
vmap ++ <plug>NERDCommenterToggle
|
2022-09-02 15:07:30 +00:00
|
|
|
nmap ++ <plug>NERDCommenterToggle
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
2022-09-01 19:23:12 +00:00
|
|
|
# }}}
|
|
|
|
# Coc {{{
|
2022-09-02 08:33:55 +00:00
|
|
|
coc = {
|
|
|
|
enable = true;
|
2022-09-02 09:22:54 +00:00
|
|
|
settings = {
|
2022-09-02 10:26:33 +00:00
|
|
|
rust-analyzer.server.path = "${pkgs.rust-analyzer}/bin/rust-analyzer";
|
2022-09-02 09:22:54 +00:00
|
|
|
};
|
2022-09-02 08:33:55 +00:00
|
|
|
pluginConfig = ''
|
2022-09-02 10:26:33 +00:00
|
|
|
let mapleader = "\<Space>"
|
|
|
|
|
2022-09-02 08:33:55 +00:00
|
|
|
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)
|
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
|
|
nmap gr <Plug>(coc-rename)
|
|
|
|
nmap <leader>ac <Plug>(coc-codeaction)
|
|
|
|
nmap <leader>qf <Plug>(coc-fix-current)
|
2022-09-02 10:26:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
" Use tab for trigger completion with characters ahead and navigate.
|
|
|
|
" NOTE: There's always complete item selected by default, you may want to enable
|
|
|
|
" no select by `"suggest.noselect": true` in your configuration file.
|
|
|
|
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
|
|
|
" other plugin before putting this into your config.
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
\ coc#pum#visible() ? coc#pum#next(1) :
|
|
|
|
\ CheckBackspace() ? "\<Tab>" :
|
|
|
|
\ coc#refresh()
|
|
|
|
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
|
|
|
|
|
|
|
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
|
|
|
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
|
|
|
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
|
|
|
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
|
|
|
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
|
|
|
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
|
|
|
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
|
|
|
" <C-g>u breaks current undo, please make your own choice.
|
|
|
|
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
|
|
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
|
|
|
|
|
|
|
function! CheckBackspace() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
|
|
|
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
|
|
|
" <C-g>u breaks current undo, please make your own choice.
|
|
|
|
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
|
|
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
|
|
|
|
|
|
|
function! CheckBackspace() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Use <c-space> to trigger completion.
|
|
|
|
if has('nvim')
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
else
|
|
|
|
inoremap <silent><expr> <c-@> coc#refresh()
|
|
|
|
endif
|
|
|
|
|
|
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
|
|
'';
|
2022-09-02 08:33:55 +00:00
|
|
|
};
|
2022-09-01 19:23:12 +00:00
|
|
|
# }}}
|
|
|
|
extraConfig = ''
|
2022-09-16 16:49:31 +00:00
|
|
|
" neovide
|
|
|
|
let g:neovide_refresh_rate_idle=5
|
2022-09-17 13:30:46 +00:00
|
|
|
let g:neovide_cursor_animation_length=0.1
|
|
|
|
let g:neovide_cursor_trail_size=0.3
|
2022-09-16 16:49:31 +00:00
|
|
|
let g:neovide_cursor_vfx_mode="railgun"
|
2022-09-17 13:30:46 +00:00
|
|
|
let g:neovide_remember_window_size = v:false
|
2022-09-16 16:49:31 +00:00
|
|
|
|
2022-09-17 13:30:46 +00:00
|
|
|
set guifont=FiraCode\ Nerd\ Font:h11
|
2022-09-01 19:23:12 +00:00
|
|
|
set fdm=marker
|
|
|
|
|
|
|
|
nmap H _
|
|
|
|
vmap H _
|
|
|
|
|
|
|
|
nmap L $
|
|
|
|
vmap L $
|
|
|
|
|
|
|
|
" terminal normal mode
|
|
|
|
tnoremap <Esc> <C-\><C-n>
|
|
|
|
|
|
|
|
" j/k move virtual lines (wrapped)
|
|
|
|
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
|
|
|
|
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
|
|
|
|
|
|
|
|
set relativenumber
|
|
|
|
set number
|
|
|
|
|
|
|
|
set smarttab
|
|
|
|
set cindent
|
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
2022-10-16 20:05:04 +00:00
|
|
|
|
|
|
|
set foldmethod=syntax
|
2022-09-01 19:23:12 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|