nvim: add nvim-treesitter-textsubjects

dev-docs
Moritz Böhme 2023-02-17 22:19:47 +01:00
parent 6f28bd821e
commit 2fe2b60fd4
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
4 changed files with 46 additions and 0 deletions

View File

@ -666,6 +666,22 @@
"type": "github"
}
},
"nvim-treesitter-textsubjects": {
"flake": false,
"locked": {
"lastModified": 1676144693,
"narHash": "sha256-4jb9v0xpO17wp85dzojKUQ6hUdNBx3T2tB4fSWoANus=",
"owner": "RRethy",
"repo": "nvim-treesitter-textsubjects",
"rev": "b913508f503527ff540f7fe2dcf1bf1d1f259887",
"type": "github"
},
"original": {
"owner": "RRethy",
"repo": "nvim-treesitter-textsubjects",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
@ -757,6 +773,7 @@
"neovim": "neovim",
"nil": "nil",
"nixpkgs": "nixpkgs_8",
"nvim-treesitter-textsubjects": "nvim-treesitter-textsubjects",
"pre-commit-hooks": "pre-commit-hooks_3",
"stable": "stable",
"utils": "utils_2"

View File

@ -56,6 +56,11 @@
hyprland.url = "github:hyprwm/Hyprland";
hyprpaper.url = "github:hyprwm/hyprpaper";
hypr-contrib.url = "github:hyprwm/contrib";
nvim-treesitter-textsubjects = {
url = "github:RRethy/nvim-treesitter-textsubjects";
flake = false;
};
};
outputs =

View File

@ -1,12 +1,27 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.programs.vim;
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
in
{
options.my.programs.vim = {
@ -46,6 +61,7 @@ in
nvim-cmp
nvim-lspconfig
nvim-surround
nvim-treesitter-textsubjects
nvim-treesitter.withAllGrammars
nvim-ts-context-commentstring
nvim-web-devicons # for dashboard-nvim

View File

@ -322,3 +322,11 @@ require("nvim-treesitter.configs").setup({
})
require("nvim-surround").setup({})
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
prev_selection = ",", -- (Optional) keymap to select the previous selection
keymaps = { ["."] = "textsubjects-smart" },
},
})