nix: Add vim treesitter plugins

This commit is contained in:
Geoffrey Frogeye 2023-11-01 09:17:01 +01:00
parent 39294e4b90
commit 068a8c9965
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
5 changed files with 16 additions and 82 deletions

View file

@ -16,15 +16,6 @@
" Theme
source ~/.config/vim/theme.vim
" Treesitter
{% if variant == 'nvim' %}
{{ use_plugin('treesitter') }}
{{ use_plugin('ts-rainbow') }}
{# TODO
{{ use_plugin('indent-blankline') }}
#}
{% endif %}
" Snippets
{{ use_plugin('vsnip') }}

View file

@ -1,3 +0,0 @@
{# Show ident lines #}
{{ add_source('lukas-reineke/indent-blankline.nvim') -}}
let g:indent_blankline_char_highlight_list = ['Error', 'Function']

View file

@ -1,66 +0,0 @@
{# Allow for better syntax highlighting. Bit experimental #}
{{ add_source('nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}) -}}
{# To check if it's really working
{{ add_source('nvim-treesitter/playground') -}}
#}
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = {
"bash",
"bibtex",
"c",
"cmake",
"comment",
"cpp",
"css",
"diff",
"dockerfile",
"dot",
"git_rebase",
"gitattributes",
"gitignore",
"go",
"html",
"http",
"java",
"javascript",
"json",
"latex",
"llvm",
"lua",
"make",
"markdown",
"markdown_inline",
"perl",
"php",
"python",
"regex",
"ruby",
"scss",
"sql",
"verilog",
"vim",
"yaml",
},
ignore_install = {},
highlight = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
{# Not very working yet, I'm afraid
indent = {
enable = true,
},
#}
}
EOF
{# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects #}

View file

@ -154,6 +154,17 @@ in
autocmd.enabled = true;
};
lspkind.enable = true; # Add icons to LSP completions
# Treesitter
treesitter = { # Allows for better syntax highlighting
enable = true;
incrementalSelection = {
enable = true;
};
# indent = true; # Not very working last time I tried apparently
};
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects
indent-blankline.enable = true; # 23.11 integrate with rainbow-delimiters and use more of the options
};
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview # Scroll bar
@ -185,11 +196,16 @@ in
# Language server
lsp_signature-nvim # Show argument definition when typing a function
# Treesitter
nvim-ts-rainbow # Randomly color parenthesis pairs
# 23.11: Replace with plugins.rainbow-delimiters
];
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
./vim/feline.lua
./vim/symbols-outline-nvim.lua
./vim/lsp_signature-nvim.lua
./vim/nvim-ts-rainbow.lua
];
extraConfigVim = ''
" vim-gutentags

View file

@ -1,6 +1,3 @@
{# Randomly color parentheses pairs #}
{{ add_source('p00f/nvim-ts-rainbow') -}}
lua << EOF
require'nvim-treesitter.configs'.setup {
rainbow = {
enable = true,
@ -8,4 +5,3 @@ require'nvim-treesitter.configs'.setup {
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
}
}
EOF