mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-05 23:26:23 +01:00
141 lines
3.4 KiB
Nix
141 lines
3.4 KiB
Nix
{ 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,... } : {
|
|
home.packages = with pkgs; [
|
|
rust-analyzer
|
|
];
|
|
programs.neovim = {
|
|
enable = true;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
vimdiffAlias = true;
|
|
# Plugins {{{
|
|
plugins = with pkgs.vimPlugins; [
|
|
nerdtree-git-plugin
|
|
ctrlp-vim
|
|
vim-nerdtree-syntax-highlight
|
|
vim-devicons
|
|
vim-nix
|
|
vim-pug
|
|
coc-rust-analyzer
|
|
coc-git
|
|
coc-fzf
|
|
coc-css
|
|
coc-yaml
|
|
coc-json
|
|
coc-html
|
|
coc-emmet
|
|
coc-vimlsp
|
|
coc-tsserver
|
|
{
|
|
plugin = gruvbox-nvim;
|
|
config = "colorscheme gruvbox";
|
|
}
|
|
{
|
|
plugin = nerdtree;
|
|
config = "nmap <C-n> :NERDTreeToggle<CR>";
|
|
}
|
|
{
|
|
plugin = nerdcommenter;
|
|
config = ''
|
|
vmap ++ <plug>NERDCommenterToggle
|
|
nmap ++ <plug>NERDCommenterToggle
|
|
'';
|
|
}
|
|
];
|
|
# }}}
|
|
# Coc {{{
|
|
coc = {
|
|
enable = true;
|
|
settings = {
|
|
rust-analyzer.server.path = "${pkgs.rust-analyzer.outPath}/bin/rust-analyzer";
|
|
};
|
|
pluginConfig = ''
|
|
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)
|
|
'';
|
|
};
|
|
# }}}
|
|
extraConfig = ''
|
|
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
|
|
|
|
" Emacs Insert mode/command mode hotkeys {{{
|
|
" movement
|
|
inoremap <C-f> <Right>
|
|
inoremap <C-b> <Left>
|
|
inoremap <C-p> <Up>
|
|
inoremap <C-n> <Down>
|
|
cnoremap <C-f> <Right>
|
|
cnoremap <C-b> <Left>
|
|
cnoremap <C-p> <Up>
|
|
cnoremap <C-n> <Down>
|
|
|
|
inoremap <C-e> <C-o>$
|
|
inoremap <C-a> <C-o>_
|
|
cnoremap <C-e> <C-o>$
|
|
cnoremap <C-a> <C-o>_
|
|
|
|
inoremap <M-f> <C-Right>
|
|
inoremap <M-b> <C-Left>
|
|
inoremap <M-e> <C-o>)
|
|
inoremap <M-a> <C-o>(
|
|
cnoremap <M-f> <C-Right>
|
|
cnoremap <M-b> <C-Left>
|
|
cnoremap <M-e> <C-o>)
|
|
cnoremap <M-a> <C-o>(
|
|
|
|
inoremap <M-<> <Esc>ggi
|
|
inoremap <M->> <Esc>Gi
|
|
cnoremap <M-<> <Esc>ggi
|
|
cnoremap <M->> <Esc>Gi
|
|
|
|
" editing
|
|
inoremap <C-d> <Del>
|
|
inoremap <M-BS> <C-o>db
|
|
inoremap <M-d> <C-o>de
|
|
cnoremap <C-d> <Del>
|
|
cnoremap <M-BS> <C-o>db
|
|
cnoremap <M-d> <C-o>de
|
|
|
|
inoremap <C-s> <C-o>/
|
|
inoremap <C-r> <C-o>?
|
|
" }}}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|