os/modules/terminal-life/nvim/default.nix
Benjamin Bädorf b487e3db6a
feat: use nnn and treesitter
vifm is removed in favour of nnn, with the keybindings in nvim being
changed. TODO: improve the colorscheme of `nnn` to match `ls`.

All nvim plugins that were responsible for language syntax highlighting
are removed in favour of treesitter[1], a syntax highlighter that parses
AST instead of being regex-based. This is still experimental, but my
tests so far have not encountered any issues.

1) https://github.com/nvim-treesitter/nvim-treesitter
2023-07-13 15:53:10 +02:00

163 lines
3.3 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;
lib.mkIf (!cfg.lite) [
ccls
gopls
nodejs
nodePackages.bash-language-server
nodePackages.dockerfile-language-server-nodejs
nodePackages.svelte-language-server
nodePackages.typescript
nodePackages.typescript-language-server
nodePackages.vim-language-server
nodePackages.vue-language-server
nodePackages.vscode-langservers-extracted
nodePackages.yaml-language-server
python39Packages.python-lsp-server
python3Full
solargraph
rnix-lsp
rust-analyzer
terraform-ls
universal-ctags
];
plugins = with pkgs.vimPlugins;
[]
++ lib.optionals (!cfg.lite) [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [
p.nix
p.markdown
p.json
p.json5
p.yaml
p.html
p.css
p.scss
p.typescript
p.tsx
p.javascript
p.graphql
p.vue
p.rust
p.go
p.gomod
p.gosum
p.ruby
p.python
p.haskell
p.c
p.cpp
p.vim
p.vimdoc
p.sql
p.passwd
p.gitcommit
p.gitignore
p.git_config
p.gitattributes
p.git_rebase
p.dockerfile
p.terraform
]))
nvim-cmp
cmp-nvim-lsp
cmp_luasnip
luasnip
lsp_extensions-nvim
nvim-lspconfig
instant-nvim-nvfetcher
# Search functionality behind :Ack
ack-vim
# The status bar in the bottom of the screen with the mode indication and file location
vim-airline
# Automatically load editorconfig files in repos to configure nvim settings
editorconfig-vim
# File browser. Use <leader>n to access
nnn-vim
quick-scope
suda-vim
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
emmet-vim
vim-caddyfile-nvfetcher
];
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)
''
];
}