neovim: Add tree sitter

This commit is contained in:
Simon Bruder 2022-06-12 22:44:55 +02:00
parent 9bc8933f55
commit fe2a821cfd
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 34 additions and 2 deletions

View file

@ -95,7 +95,6 @@ in
vim-nix
vim-openscad
vim-snippets
vim-toml
vimtex
which-key-nvim
];
@ -104,7 +103,29 @@ in
xdg.configFile = {
"nvim/lua/init.lua".source = ./init.lua;
"nvim/lua/snippets.lua".source = pkgs.callPackage ./snippets.nix { };
};
} // (lib.mapAttrs'
(name: path: lib.nameValuePair "nvim/parser/${lib.removePrefix "tree-sitter-" name}.so" { source = "${path}/parser"; })
({
inherit (pkgs.tree-sitter.builtGrammars)
tree-sitter-bash
tree-sitter-c
tree-sitter-cpp
tree-sitter-css
tree-sitter-dot
tree-sitter-go
tree-sitter-haskell
tree-sitter-html
tree-sitter-json
#tree-sitter-latex # incompatible with VimTeX
tree-sitter-lua
tree-sitter-nix
tree-sitter-perl
tree-sitter-python
tree-sitter-rust
tree-sitter-scss
tree-sitter-toml
tree-sitter-yaml;
}));
home.sessionVariables.EDITOR = "nvim";
}

View file

@ -305,6 +305,17 @@ lsp.rust_analyzer.setup {
require('trouble').setup {}
-- Tree Sitter
require('nvim-treesitter.configs').setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
}
-- VimTeX
g.tex_flavor = 'latex'
g.vimtex_view_method = 'zathura'