Add nvim-lazy submodule and add plugin configuration.
This commit is contained in:
parent
f545e30831
commit
b1ad0b623a
39 changed files with 1599 additions and 0 deletions
69
pkgsets/nvim/treesitter.nix
Normal file
69
pkgsets/nvim/treesitter.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf (lib.elem "nvim::treesitter" config.machine.pkgs) {
|
||||
programs.nvim-lazy.lazyPlugins =
|
||||
let
|
||||
org-grammar = pkgs.tree-sitter.buildGrammar {
|
||||
language = "org";
|
||||
version = "1.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "nvim-orgmode";
|
||||
repo = "tree-sitter-org";
|
||||
rev = "436c2dec440e6ad40be98f3b712537bbb08bef0b";
|
||||
hash = "sha256-k/i+7/K6puXg554BWSLHIDlOXElUovOwOEe5i1Q95L8=";
|
||||
};
|
||||
};
|
||||
# all grammars except replace org-mode
|
||||
treesitter = pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
||||
_:
|
||||
(lib.filter (grammar: grammar.pname != "org-grammar") pkgs.vimPlugins.nvim-treesitter.allGrammars)
|
||||
++ [ org-grammar ]
|
||||
);
|
||||
#treesitter = pkgs.vimPlugins.nvim-treesitter.withAllGrammars;
|
||||
grammars = pkgs.symlinkJoin {
|
||||
name = "treesitter-parsers";
|
||||
paths = treesitter.dependencies;
|
||||
};
|
||||
in
|
||||
[
|
||||
{
|
||||
lazy = false;
|
||||
dir = treesitter;
|
||||
event = [
|
||||
"BufReadPost"
|
||||
"BufWritePost"
|
||||
"BufNewFile"
|
||||
"VeryLazy"
|
||||
];
|
||||
config = # lua
|
||||
''
|
||||
function()
|
||||
vim.opt.rtp:prepend("${grammars}")
|
||||
require("nvim-treesitter.configs").setup({
|
||||
auto_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "gnn", -- set to `false` to disable one of the mappings
|
||||
node_incremental = "grn",
|
||||
scope_incremental = "grc",
|
||||
node_decremental = "grm",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
})
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue