summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-06-06 04:54:32 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-06-06 04:54:32 -0600
commitdbafb06b8c2281913d295e01bf09db4e3554a4c8 (patch)
tree162bc1bb7e3e218cf9508ee64f027be41b12076f
parent2ad3c42b0b1ac709821db1ebf1ab7a444d0b3a49 (diff)
change keymaps for treesitter, need more tweaking
-rw-r--r--README.md1
-rw-r--r--lua/plugins/treesitter.lua32
2 files changed, 20 insertions, 13 deletions
diff --git a/README.md b/README.md
index 624b924..1139637 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@ Personal [`neovim`](https://github.com/neovim/neovim) configuration using [`lazy
## To do
+- [ ] fine tune keymaps for [`treesitter.lua`](/lua/plugins/treesitter.lua).
- [ ] tidy up the configs for all plugins again.
- [ ] further personalize plugin configs.
- [ ] check up on the suggested config from [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig#suggested-configuration).
diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua
index 6d423a8..7105fc0 100644
--- a/lua/plugins/treesitter.lua
+++ b/lua/plugins/treesitter.lua
@@ -19,15 +19,17 @@ return {
highlight = { enable = true },
indent = {
enable = true,
- disable = { 'python' },
+ disable = {
+ 'python',
+ 'css',},
},
incremental_selection = {
enable = true,
keymaps = {
- init_selection = '<c-space>',
- node_incremental = '<c-space>',
- scope_incremental = '<c-s>',
- node_decremental = '<M-space>',
+ init_selection = '<cr>',
+ node_incremental = '<tab>',
+ node_decremental = '<s-tab>',
+ scope_incremental = '<cr>',
},
},
textobjects = {
@@ -35,16 +37,19 @@ return {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
+ include_surrounding_whitespace = false,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
- ['aa'] = '@parameter.outer',
- ['ia'] = '@parameter.inner',
- ['af'] = '@function.outer',
- ['if'] = '@function.inner',
- ['ac'] = '@class.outer',
- ['ic'] = '@class.inner',
+ -- The descriptions are simplistic to match the native descriptions
+ ['aa'] = { query = '@parameter.outer', desc = 'a parameter' },
+ ['ia'] = { query = '@parameter.inner', desc = 'a parameter' },
+ ['af'] = { query = '@function.outer', desc = 'a function' },
+ ['if'] = { query = '@function.inner', desc = 'a function' },
+ ['ac'] = { query = '@class.outer', desc = 'a class' },
+ ['ic'] = { query = '@class.inner', desc = 'a class' },
},
},
+ -- TODO: change these keymaps to better ones
move = {
enable = true,
-- Whether to set jumps in the jumplist
@@ -66,13 +71,14 @@ return {
['[]'] = '@class.outer',
},
},
+ -- TODO: probably change to <leader>sa (swap argument)
swap = {
enable = true,
swap_next = {
- ['<leader>a'] = '@parameter.inner',
+ ['<leader>a'] = { query = '@parameter.inner', desc = 'Swap with next parameter' },
},
swap_previous = {
- ['<leader>A'] = '@parameter.inner',
+ ['<leader>A'] = { query = '@parameter.inner', desc = 'Swap with previous parameter' },
},
},
},