feat: add lazy loading to nvim
This commit is contained in:
parent
6ebfb3d109
commit
752dfc55e8
64 changed files with 68 additions and 1265 deletions
|
|
@ -1,68 +1,26 @@
|
|||
{ pkgs, inputs, lib, ... }:
|
||||
{ config, lib, pkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf readFile;
|
||||
in
|
||||
{
|
||||
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [
|
||||
(
|
||||
let
|
||||
nvim-treesitter = pkgs.vimPlugins.nvim-treesitter;
|
||||
parserDir = pkgs.symlinkJoin {
|
||||
name = "tresitter-grammars-all";
|
||||
paths = nvim-treesitter.withAllGrammars.dependencies;
|
||||
};
|
||||
in
|
||||
{
|
||||
plugin = nvim-treesitter;
|
||||
event = [ "BufReadPost" "BufNewFile" ];
|
||||
opts = {
|
||||
sync_install = false;
|
||||
auto_install = false;
|
||||
highlight = {
|
||||
enable = true;
|
||||
disable = [ "latex" ];
|
||||
};
|
||||
textobjects =
|
||||
{
|
||||
select =
|
||||
{
|
||||
enable = true;
|
||||
|
||||
# Automatically jump forward to textobj, similar to targets.vim
|
||||
lookahead = false;
|
||||
|
||||
keymaps = {
|
||||
# You can use the capture groups defined in textobjects.scm
|
||||
"af" = {
|
||||
query = "@function.outer";
|
||||
desc = "Select outer part of a function region";
|
||||
};
|
||||
"if" = {
|
||||
query = "@function.inner";
|
||||
desc = "Select inner part of a function region";
|
||||
};
|
||||
"ac" = {
|
||||
query = "@class.outer";
|
||||
desc = "Select outer part of a class region";
|
||||
};
|
||||
"ic" = {
|
||||
query = "@class.inner";
|
||||
desc = "Select inner part of a class region";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
conf =
|
||||
/* lua */ ''
|
||||
vim.opt.runtimepath:append("${parserDir}")
|
||||
local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" })
|
||||
require('nvim-treesitter.configs').setup(final_opts)
|
||||
'';
|
||||
priority = 100;
|
||||
dependencies = [
|
||||
{ plugin = pkgs.vimPlugins.nvim-treesitter-textobjects; }
|
||||
{ plugin = pkgs.vimPlugins.nvim-ts-context-commentstring; opts = { }; }
|
||||
];
|
||||
}
|
||||
)
|
||||
];
|
||||
home-manager.users.moritz.programs.nixvim = {
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
folding = true;
|
||||
nixvimInjections = true;
|
||||
settings.indent.enable = true;
|
||||
settings.highlight.enable = true;
|
||||
settings.incremental_selection = {
|
||||
enable = true;
|
||||
keymaps.init_selection = "gn";
|
||||
keymaps.node_decremental = "gp";
|
||||
keymaps.node_incremental = "gn";
|
||||
};
|
||||
lazyLoad.settings.event = [ "DeferredUIEnter" ];
|
||||
};
|
||||
performance.combinePlugins.standalonePlugins = [
|
||||
"nvim-treesitter"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue