mfussenegger/nvim-ts-hint-textobject

github github
motions plugin
star 84
stars
alert-circle 5
open issues
users 2
subscribers
git-branch 4
forks
CREATED

2021-06-13

UPDATED

16 hours ago

packer

require('packer').startup(function()
  use 'mfussenegger/nvim-ts-hint-textobject'
end)

paq

require "paq" { 
  'mfussenegger/nvim-ts-hint-textobject'
}

TSHT (Treesitter hint textobject)

Plugin that provides region selection using hints on the abstract syntax tree of a document. This is intended to be used for pending operator mappings.

Demo

Requirements

  • Requires Neovim HEAD/Nightly
  • A treesitter parser for each language you plan to use the plugin with.
    • Parsers can be installed via nvim-treesitter TSInstall
    • For manual installation, you need to compile the language specific parsers using gcc and place the object files into ~/.config/nvim/parser.
  • locals queries for each language you plan to use the plugin with.
    • nvim-treesitter ships locals queries for many languages. If you've it installed they'll be picked up.
    • You can install them manually by placing locals.scm query files into ~/.config/nvim/queries/<language>/

Installation

  • nvim-ts-hint-textobject is a plugin. Install it like any other neovim plugin:
    • If using vim-plug: Plug mfussenegger/nvim-ts-hint-textobject
    • If using packer.nvim: use mfussenegger/nvim-ts-hint-textobject

Usage

Define two mapppings:

omap     <silent> m :<C-U>lua require('tsht').nodes()<CR>
vnoremap <silent> m :lua require('tsht').nodes()<CR>

You can configure which keys are used for hint labels, the first N characters will be taken from the hint_keys and then after that it will restart from a-zA-Z

require("tsht").config.hint_keys = { "h", "j", "f", "d", "n", "v", "s", "l", "a" }

Credits