devos/users/modules/neovim/default.nix

61 lines
1.8 KiB
Nix

{ lib, pkgs, config, ... }@inputs:
with lib;
let
cfg = config.mae.nvim;
in
{
imports = [
./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)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" 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
'';
};
};
}