mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 08:50:11 -04:00
Merge pull request #39 from vigoux/incremental_selection
Move textobj module to incremental_selection.
This commit is contained in:
commit
0207836eb2
2 changed files with 8 additions and 4 deletions
|
|
@ -214,7 +214,7 @@ local config = {
|
||||||
return queries.get_query(ft, 'highlights') ~= nil
|
return queries.get_query(ft, 'highlights') ~= nil
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
textobj = {
|
incremental_selection = {
|
||||||
enable = false,
|
enable = false,
|
||||||
disable = {},
|
disable = {},
|
||||||
keymaps = {
|
keymaps = {
|
||||||
|
|
@ -403,4 +403,8 @@ function M.available_modules()
|
||||||
return vim.tbl_keys(config.modules)
|
return vim.tbl_keys(config.modules)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.get_module(mod)
|
||||||
|
return config.modules[mod]
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,10 @@ end)
|
||||||
function M.attach(bufnr)
|
function M.attach(bufnr)
|
||||||
local buf = bufnr or api.nvim_get_current_buf()
|
local buf = bufnr or api.nvim_get_current_buf()
|
||||||
|
|
||||||
local config = require'nvim-treesitter.configs'.get_config().textobj
|
local config = require'nvim-treesitter.configs'.get_module('incremental_selection')
|
||||||
for funcname, mapping in pairs(config.keymaps) do
|
for funcname, mapping in pairs(config.keymaps) do
|
||||||
api.nvim_buf_set_keymap(buf, 'v', mapping,
|
api.nvim_buf_set_keymap(buf, 'v', mapping,
|
||||||
string.format(":lua require'nvim-treesitter.textobj'.%s()<CR>", funcname), { silent = true })
|
string.format(":lua require'nvim-treesitter.incremental_selection'.%s()<CR>", funcname), { silent = true })
|
||||||
api.nvim_buf_set_keymap(buf, 'o', mapping,
|
api.nvim_buf_set_keymap(buf, 'o', mapping,
|
||||||
string.format(":normal v%s<CR>", mapping), { silent = true })
|
string.format(":normal v%s<CR>", mapping), { silent = true })
|
||||||
end
|
end
|
||||||
|
|
@ -68,7 +68,7 @@ end
|
||||||
function M.detach(bufnr)
|
function M.detach(bufnr)
|
||||||
local buf = bufnr or api.nvim_get_current_buf()
|
local buf = bufnr or api.nvim_get_current_buf()
|
||||||
|
|
||||||
local config = require'nvim-treesitter.configs'.get_config().textobj
|
local config = require'nvim-treesitter.configs'.get_module('incremental_selection')
|
||||||
for _, mapping in pairs(config.keymaps) do
|
for _, mapping in pairs(config.keymaps) do
|
||||||
api.nvim_buf_del_keymap(buf, 'v', mapping)
|
api.nvim_buf_del_keymap(buf, 'v', mapping)
|
||||||
api.nvim_buf_del_keymap(buf, 'o', mapping)
|
api.nvim_buf_del_keymap(buf, 'o', mapping)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue