refactor(nvim): move treesitter stuff to its own file

This commit is contained in:
matt1432 2024-05-06 18:14:52 -04:00
parent 7691490e00
commit 3348300ab7
3 changed files with 123 additions and 100 deletions

View file

@ -35,6 +35,10 @@ in {
}
];
imports = [
./treesitter.nix
];
home = optionalAttrs neovimIde {
packages = with pkgs; [
gradle
@ -301,85 +305,6 @@ in {
*/
''require('easytables').setup();'';
}
]
# Treesitter
++ [
vimPlugins.nvim-treesitter-context
vimPlugins.nvim-treesitter-textobjects
{
type = "viml";
config = fileContents ./plugins/treesitter.vim;
plugin = vimPlugins.nvim-treesitter.withPlugins (p: [
p.awk
p.bash
p.c
p.c_sharp
p.cairo
p.cmake
p.comment
p.cpp
p.css
p.csv
p.cuda
p.diff
p.dockerfile
p.dot
p.git_config
p.git_rebase
p.gitattributes
p.gitcommit
p.gitignore
p.go
p.gomod
p.gosum
p.groovy
p.haskell
p.haskell_persistent
p.hyprlang
p.html
p.ini
p.java
p.javascript
p.jq
p.jsdoc
p.json
p.json5
p.jsonc
p.jsonnet
p.kotlin
p.latex
p.lua
p.luadoc
p.make
p.markdown
p.meson
p.ninja
p.nix
p.passwd
p.perl
p.php
p.phpdoc
p.properties
p.python
p.rasi
p.regex
p.requirements
p.ruby
p.rust
p.scss
p.sql
p.ssh_config
p.toml
p.todotxt
p.typescript
p.udev
p.vim
p.vimdoc
p.vue
p.xml
p.yaml
]);
}
];
};
};

View file

@ -1,21 +0,0 @@
lua << EOF
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
})
require('treesitter-context').setup({
enable = true,
max_lines = 3,
min_window_height = 20,
})
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})
EOF
" Add line under context
hi TreesitterContextBottom gui=underline guisp=Grey

View file

@ -0,0 +1,119 @@
{pkgs, ...}: let
inherit (pkgs) vimPlugins;
in {
programs = {
neovim = {
plugins = [
{
plugin = vimPlugins.nvim-treesitter-context;
type = "lua";
config =
/*
lua
*/
''
require('treesitter-context').setup({
enable = true,
max_lines = 3,
min_window_height = 20,
});
vim.cmd(
'hi TreesitterContextBottom gui=underline guisp=Grey'
);
'';
}
vimPlugins.nvim-treesitter-textobjects
{
type = "lua";
config =
/*
lua
*/
''
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
});
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
});
'';
plugin = vimPlugins.nvim-treesitter.withPlugins (p: [
p.awk
p.bash
p.c
p.c_sharp
p.cairo
p.cmake
p.comment
p.cpp
p.css
p.csv
p.cuda
p.diff
p.dockerfile
p.dot
p.git_config
p.git_rebase
p.gitattributes
p.gitcommit
p.gitignore
p.go
p.gomod
p.gosum
p.groovy
p.haskell
p.haskell_persistent
p.hyprlang
p.html
p.ini
p.java
p.javascript
p.jq
p.jsdoc
p.json
p.json5
p.jsonc
p.jsonnet
p.kotlin
p.latex
p.lua
p.luadoc
p.make
p.markdown
p.meson
p.ninja
p.nix
p.passwd
p.perl
p.php
p.phpdoc
p.properties
p.python
p.rasi
p.regex
p.requirements
p.ruby
p.rust
p.scss
p.sql
p.ssh_config
p.toml
p.todotxt
p.typescript
p.udev
p.vim
p.vimdoc
p.vue
p.xml
p.yaml
]);
}
];
};
};
}