plugins/treesitter: move to by-name

This commit is contained in:
Matt Sturgeon 2024-09-04 17:53:24 +01:00
parent 8815180c62
commit 4491ce4db2
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
18 changed files with 0 additions and 8 deletions

View file

@ -1,37 +0,0 @@
{ pkgs, ... }:
{
combine-plugins = {
performance.combinePlugins.enable = true;
plugins.treesitter = {
enable = true;
# Exclude nixvim injections for test to pass
nixvimInjections = false;
};
extraConfigLuaPost = ''
-- Ensure that queries from nvim-treesitter are first in rtp
local queries_path = "${pkgs.vimPlugins.nvim-treesitter}/queries"
for name, type in vim.fs.dir(queries_path, {depth = 10}) do
if type == "file" then
-- Resolve all symlinks and compare nvim-treesitter's path with
-- whatever we've got from runtime
local nvim_treesitter_path = assert(vim.uv.fs_realpath(vim.fs.joinpath(queries_path, name)))
local rtp_path = assert(
vim.uv.fs_realpath(vim.api.nvim_get_runtime_file("queries/" .. name, false)[1]),
name .. " not found in runtime"
)
assert(
nvim_treesitter_path == rtp_path,
string.format(
"%s from rtp (%s) is not the same as from nvim-treesitter (%s)",
name,
rtp_path, nvim_treesitter_path
)
)
end
end
'';
};
}

View file

@ -1,8 +0,0 @@
{
empty = {
plugins = {
hmts.enable = true;
treesitter.enable = true;
};
};
}

View file

@ -1,69 +0,0 @@
{
empty = {
plugins = {
treesitter.enable = true;
rainbow-delimiters.enable = true;
};
};
example = {
plugins = {
treesitter.enable = true;
rainbow-delimiters = {
enable = true;
strategy = {
default = "global";
html = "local";
latex.__raw = ''
function()
-- Disabled for very large files, global strategy for large files,
-- local strategy otherwise
if vim.fn.line('$') > 10000 then
return nil
elseif vim.fn.line('$') > 1000 then
return rainbow.strategy['global']
end
return rainbow.strategy['local']
end
'';
};
query = {
default = "rainbow-delimiters";
lua = "rainbow-blocks";
};
highlight = [
"RainbowDelimiterRed"
"RainbowDelimiterYellow"
"RainbowDelimiterBlue"
"RainbowDelimiterOrange"
"RainbowDelimiterGreen"
"RainbowDelimiterViolet"
"RainbowDelimiterCyan"
];
blacklist = [
"c"
"cpp"
];
log = {
file.__raw = "vim.fn.stdpath('log') .. '/rainbow-delimiters.log'";
level = "warn";
};
};
};
};
example-whitelist = {
plugins = {
treesitter.enable = true;
rainbow-delimiters = {
enable = true;
whitelist = [
"c"
"cpp"
];
};
};
};
}

View file

@ -1,30 +0,0 @@
{
empty = {
plugins = {
treesitter.enable = true;
treesitter-context.enable = true;
};
};
default = {
plugins = {
treesitter.enable = true;
treesitter-context = {
enable = true;
settings = {
enable = true;
max_lines = 0;
min_window_height = 0;
line_numbers = true;
multiline_threshold = 20;
trim_scope = "outer";
mode = "cursor";
separator = null;
zindex = 20;
on_attach = null;
};
};
};
};
}

View file

@ -1,84 +0,0 @@
{
empty = {
plugins = {
treesitter.enable = true;
treesitter-textobjects.enable = true;
};
};
example = {
plugins = {
treesitter.enable = true;
treesitter-textobjects = {
enable = true;
select = {
enable = true;
disable = [ ];
lookahead = true;
keymaps = {
af = "@function.outer";
"if" = "@function.inner";
ac = "@class.outer";
ic = {
query = "@class.inner";
desc = "Select inner part of a class region";
};
};
selectionModes = {
"@parameter.outer" = "v";
"@function.outer" = "V";
"@class.outer" = "<c-v>";
};
includeSurroundingWhitespace = true;
};
swap = {
enable = true;
disable = [ ];
swapNext = {
"<leader>a" = "@parameter.inner";
};
swapPrevious = {
"<leader>A" = "@parameter.inner";
};
};
move = {
enable = true;
disable = [ ];
setJumps = true;
gotoNextStart = {
"]m" = "@function.outer";
"]]" = "@class.outer";
};
gotoNextEnd = {
"]M" = "@function.outer";
"][" = "@class.outer";
};
gotoPreviousStart = {
"[m" = "@function.outer";
"[[" = "@class.outer";
};
gotoPreviousEnd = {
"[M" = "@function.outer";
"[]" = "@class.outer";
};
gotoNext = {
"]d" = "@conditional.outer";
};
gotoPrevious = {
"[d" = "@conditional.outer";
};
};
lspInterop = {
enable = true;
border = "none";
peekDefinitionCode = {
"<leader>df" = "@function.outer";
"<leader>dF" = "@class.outer";
};
floatingPreviewOpts = { };
};
};
};
};
}

View file

@ -1,137 +0,0 @@
{ pkgs, ... }:
{
default = {
plugins.treesitter = {
enable = true;
settings = {
auto_install = false;
ensure_installed = [ ];
ignore_install = [ ];
# NOTE: This is our default, not the plugin's
parser_install_dir.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'site')";
sync_install = false;
highlight = {
additional_vim_regex_highlighting = false;
enable = false;
custom_captures = { };
disable = null;
};
incremental_selection = {
enable = false;
keymaps = {
init_selection = "gnn";
node_incremental = "grn";
scope_incremental = "grc";
node_decremental = "grm";
};
};
indent = {
enable = false;
};
};
};
};
empty = {
plugins.treesitter.enable = true;
};
empty-grammar-packages = {
plugins.treesitter = {
enable = true;
grammarPackages = [ ];
};
};
highlight-disable-function = {
plugins.treesitter = {
enable = true;
settings = {
highlight = {
enable = true;
disable = ''
function(lang, bufnr)
return api.nvim_buf_line_count(bufnr) > 50000
end
'';
};
};
};
};
nixvim-injections = {
plugins.treesitter = {
enable = true;
nixvimInjections = true;
languageRegister = {
cpp = "onelab";
python = [
"foo"
"bar"
];
};
};
};
no-nix = {
# TODO: See if we can build parsers (legacy way)
test.runNvim = false;
plugins.treesitter = {
enable = true;
nixGrammars = false;
};
};
specific-grammars = {
plugins.treesitter = {
enable = true;
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
bash
git_config
git_rebase
gitattributes
gitcommit
gitignore
json
jsonc
lua
make
markdown
meson
ninja
nix
readline
regex
ssh-config
toml
vim
vimdoc
xml
yaml
];
};
};
disable-init-selection = {
plugins.treesitter = {
enable = true;
settings = {
incremental_selection = {
enable = true;
keymaps.init_selection = false;
};
};
};
};
}

View file

@ -1,67 +0,0 @@
{
empty = {
plugins = {
treesitter.enable = true;
ts-autotag.enable = true;
};
};
default = {
plugins = {
treesitter.enable = true;
ts-autotag = {
enable = true;
settings = {
opts = {
enable_close = true;
enable_rename = true;
enable_close_on_slash = true;
};
aliases = {
"astro" = "html";
"eruby" = "html";
"vue" = "html";
"htmldjango" = "html";
"markdown" = "html";
"php" = "html";
"twig" = "html";
"blade" = "html";
"javascriptreact" = "typescriptreact";
"javascript.jsx" = "typescriptreact";
"typescript.tsx" = "typescriptreact";
"javascript" = "typescriptreact";
"typescript" = "typescriptreact";
"rescript" = "typescriptreact";
"handlebars" = "glimmer";
"hbs" = "glimmer";
"rust" = "rust";
};
per_filetype = { };
};
};
};
};
example = {
plugins = {
treesitter.enable = true;
ts-autotag = {
enable = true;
settings = {
opts = {
enable_close = true;
enable_rename = true;
enable_close_on_slash = false;
};
per_filetype = {
html = {
enable_close = false;
};
};
};
};
};
};
}

View file

@ -1,10 +0,0 @@
{
empty = {
plugins = {
treesitter.enable = true;
ts-context-commentstring.enable = true;
};
};
# This plugin has no option
}