devos/users/modules/neovim/default.nix
2022-08-17 01:26:57 +02:00

60 lines
1.7 KiB
Nix

{ lib, pkgs, config, ... }@inputs:
with lib;
let
cfg = config.mae.nvim;
in
{
imports = [
./js.nix
./go.nix
./rust.nix
./web_dev.nix
./other_langs.nix
];
options.mae.nvim = {
enable = mkEnableOption "enable neovim";
};
config = {
programs.neovim = mkIf cfg.enable {
enable = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
neoformat
undotree
fzf-vim
{
plugin = iceberg-vim;
config = "colorscheme iceberg";
}
vim-sleuth
];
extraConfig = ''
set background=dark
set termguicolors
set ic
set number
set autoindent
set completeopt=menuone,noinsert,noselect
set shortmess+=c
'';
coc.pluginConfig = ''
nmap <silent> <F2> <Plug>(coc-rename)
nmap <silent> <F3> <Plug>(coc-codeaction-line)
" Remap <C-f> and <C-b> for scroll float windows/popups.
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
'';
};
};
}