Skip to content

d-itu/incsel.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tree-Sitter Powered Incremental Selection

Bring back incremental_selection of nvim-treesitter

Installation

vim.pack

vim.pack.add("https://github.com/d-itu/incsel.nvim", { load = false })

lazy.nvim

This plugin can be lazily loaded.

{
    'd-itu/incsel.nvim',
    keys = {
        -- ...
    },
},

Configuration

This plugin has no setup. It contains some functions which you can bind to your preferred keys. Here is an example:

local incsel = require "incsel"
vim.keymap.set('n', '<CR>', function()
  if not incsel.init_selection() then
    vim.cmd "normal \r\n"
  end
end, {
  desc = "Start selecting nodes with nvim-treesitter"
})
vim.keymap.set('x', '<CR>', function()
  if not incsel.incremental() then
    vim.cmd "normal \r\n"
  end
end, {
  desc = "Increment selection to named node"
})
vim.keymap.set('x', '<BS>', function()
  if not incsel.decremental() then
    vim.cmd "normal \x1b"
  end
end, {
  desc = "Shrink selection to previous named node"
})

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages