These keybinds use nvim-0.12 functionality. Later commits should introduce a backwards compatible option until every system I use has nvim-0.12 available natively
52 lines
1.2 KiB
Lua
52 lines
1.2 KiB
Lua
-- NOTE: MOST PLUGIN KEY-BINDS ARE LOCATED IN THE PLUGINS SPEC
|
|
-- As a general rule of thumb:
|
|
-- * if the key-bind requires a given plugin be loaded
|
|
-- * or is/can be used to lazy-load a plugin
|
|
-- It doesn't belong here
|
|
|
|
-- NOTE: I am not using any convenience function here.
|
|
-- Instead I am using the `vim.keymap.set` function bare.
|
|
-- This is to make it easier to know what this is doing
|
|
-- if I come back to edit a binding later.
|
|
|
|
|
|
-- ! Use native tree-sitter incremental highlighting when possible.
|
|
if vim.fn.has('nvim-0.12') == 1 then
|
|
vim.keymap.set({'n','x'}, '<TAB>',
|
|
function ()
|
|
require('vim.treesitter._select')
|
|
.select_next(vim.v.count1)
|
|
end,
|
|
{
|
|
desc = 'Select next Treesitter Node'
|
|
}
|
|
)
|
|
vim.keymap.set({'n','x'}, '<S-TAB>',
|
|
function ()
|
|
require('vim.treesitter._select')
|
|
.select_prev(vim.v.count1)
|
|
end,
|
|
{
|
|
desc = 'Select previous Treesitter Node'
|
|
}
|
|
)
|
|
vim.keymap.set({'n','x'}, '<CR>',
|
|
function ()
|
|
require('vim.treesitter._select')
|
|
.select_parent(vim.v.count1)
|
|
end,
|
|
{
|
|
desc = 'Select parent TS node'
|
|
}
|
|
)
|
|
vim.keymap.set({'n','x'}, '<S-CR>',
|
|
function ()
|
|
require('vim.treesitter._select')
|
|
.select_child(vim.v.count1)
|
|
end,
|
|
{
|
|
desc = 'Select child TS node'
|
|
}
|
|
)
|
|
end
|