pub-solar-os/modules/terminal-life/nvim/default.nix

116 lines
2.2 KiB
Nix

{ config, pkgs, lib, ... }:
let
psCfg = config.pub-solar;
cfg = config.pub-solar.terminal-life;
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
preview-file = pkgs.writeShellScriptBin "preview-file" (import ./preview-file.nix pkgs);
in
{
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withRuby = true;
withPython3 = true;
extraPackages = with pkgs; [
rnix-lsp
universal-ctags
]
++ lib.optionals (!cfg.lite) [
gopls
python39Packages.python-lsp-server
python3Full
]
;
plugins = with pkgs.vimPlugins; [
]
++ lib.optionals (!cfg.lite) [
nvim-cmp
cmp-nvim-lsp
cmp_luasnip
luasnip
lsp_extensions-nvim
nvim-lspconfig
instant-nvim-nvfetcher
ack-vim
vim-airline
editorconfig-vim
nnn-vim
quick-scope
suda-vim
syntastic
vim-gutentags
vim-vinegar
vim-workspace-nvfetcher
sonokai
vim-hybrid-material
vim-airline-themes
vim-apprentice-nvfetcher
fugitive
vim-gitgutter
vim-rhubarb
vimagit-nvfetcher
fzf-vim
fzfWrapper
vim-highlightedyank
vim-beautify-nvfetcher
vim-surround
vim-bufkill
vim-sensible
ansible-vim
emmet-vim
rust-vim
vim-caddyfile-nvfetcher
vim-go
vim-javascript
vim-json
SchemaStore-nvim
vim-markdown
vim-nix
vim-nixhash
vim-ruby
vim-toml
vim-vue
yats-vim
];
extraConfig = builtins.concatStringsSep "\n" [
''
" Persistent undo
set undofile
set undodir=${xdg.cacheHome}/nvim/undo
set backupdir=${xdg.dataHome}/nvim/backup
set directory=${xdg.dataHome}/nvim/swap/
''
(builtins.readFile ./init.vim)
(builtins.readFile ./plugins.vim)
(builtins.readFile ./clipboard.vim)
(builtins.readFile ./ui.vim)
(builtins.readFile ./quickfixopenall.vim)
(builtins.readFile ./lsp.vim)
''
" fzf with file preview
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, { 'options': ['--keep-right', '--cycle', '--layout', 'reverse', '--preview', '${preview-file}/bin/preview-file {}'] }, <bang>0)
''
];
}