Skip to content

Commit

Permalink
feat: remove incremental selection
Browse files Browse the repository at this point in the history
  • Loading branch information
konradmalik committed Sep 30, 2023
1 parent 8ebd2d8 commit 9aaeb5f
Showing 1 changed file with 25 additions and 34 deletions.
59 changes: 25 additions & 34 deletions config/native/plugin/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,74 +9,65 @@ require("nvim-treesitter.configs").setup({
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
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',
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
["<leader>A"] = "@parameter.inner",
},
},
},
})

require("treesitter-context").setup {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
require("treesitter-context").setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 5, -- How many lines the window should span. Values <= 0 mean no limit.
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
default = {
'class',
'function',
'method',
"class",
"function",
"method",
-- 'for', -- These won't appear in the context
-- 'while',
-- 'if',
Expand All @@ -95,4 +86,4 @@ require("treesitter-context").setup {
-- exactly match "impl_item" only)
-- rust = true,
},
}
})

0 comments on commit 9aaeb5f

Please sign in to comment.