nvim: plugins/treesitter: Enable treesitter text objects

This commit is contained in:
Sanchayan Maity 2021-05-22 15:30:52 +05:30
parent f846dace39
commit 66f07fba89
2 changed files with 26 additions and 3 deletions

View file

@ -129,7 +129,8 @@ local init = function ()
}
-- For C, Lua and Rust
use {
'nvim-treesitter/nvim-treesitter',
'nvim-treesitter/nvim-treesitter-textobjects',
requires = { 'nvim-treesitter/nvim-treesitter' },
config = "require('treesitter')",
}
-- All writing needs

View file

@ -1,6 +1,28 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "bash", "c", "clojure", "cpp", "fennel", "fish", "java", "javascript", "jsdoc", "json", "lua", "nix", "python", "rust", "toml" },
highlight = {
enable = true,
highlight = { enable = true, },
textobjects = {
select = {
enable = true,
keymaps = {
["<Leader><Leader>ab"] = "@block.outer" ,
["<Leader><Leader>ib"] = "@block.inner" ,
["<Leader><Leader>aC"] = "@call.outer" ,
["<Leader><Leader>iC"] = "@call.inner" ,
["<Leader><Leader>ao"] = "@class.outer" ,
["<Leader><Leader>io"] = "@class.inner" ,
["<Leader><Leader>at"] = "@comment.outer" ,
["<Leader><Leader>ac"] = "@conditional.outer",
["<Leader><Leader>ic"] = "@conditional.inner",
["<Leader><Leader>af"] = "@function.outer" ,
["<Leader><Leader>if"] = "@function.inner" ,
["<Leader><Leader>al"] = "@loop.outer" ,
["<Leader><Leader>il"] = "@loop.inner" ,
["<Leader><Leader>ap"] = "@parameter.outer" ,
["<Leader><Leader>ip"] = "@parameter.inner" ,
["<Leader><Leader>is"] = "@scopename.inner" ,
["<Leader><Leader>as"] = "@statement.outer" ,
},
},
},
}