feat(nvim): add treesitter-textobjects

nixos
Moritz Böhme 2024-10-26 17:02:51 +02:00
parent a793777d5d
commit a12ae9cb3f
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,91 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.treesitter-textobjects = {
enable = true;
move = {
enable = true;
gotoNext = {
"]f" = {
desc = "Next function";
query = "@function.outer";
};
"]c" = {
desc = "Next class";
query = "@class.outer";
};
"]b" = {
desc = "Next block";
query = "@block.outer";
};
"]P" = {
desc = "Next parameter";
query = "@parameter.outer";
};
};
gotoPrevious = {
"[f" = {
desc = "Previous function";
query = "@function.outer";
};
"[c" = {
desc = "Previous class";
query = "@class.outer";
};
"[b" = {
desc = "Previous block";
query = "@block.outer";
};
"[P" = {
desc = "Previous parameter";
query = "@parameter.outer";
};
};
};
select = {
enable = true;
keymaps = {
"af" = {
desc = "function";
query = "@function.outer";
};
"if" = {
desc = "inner function";
query = "@function.inner";
};
"ac" = {
desc = "class";
query = "@class.outer";
};
"ic" = {
desc = "inner class";
query = "@class.inner";
};
"ab" = {
desc = "block";
query = "@block.outer";
};
"ib" = {
desc = "inner block";
query = "@block.inner";
};
"aP" = {
desc = "parameter";
query = "@parameter.outer";
};
"iP" = {
desc = "inner parameter";
query = "@parameter.inner";
};
};
};
};
performance.combinePlugins.standalonePlugins = [
"nvim-treesitter-textobjects"
];
};
}