nvim: treesitter: Update treesitter configuration
This commit is contained in:
parent
2ff1ba46e1
commit
ff93725694
1 changed files with 68 additions and 25 deletions
|
@ -1,27 +1,75 @@
|
||||||
|
-- Required to enable textobjects. See
|
||||||
|
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects/issues/100.
|
||||||
|
require'nvim-treesitter-textobjects'
|
||||||
|
|
||||||
|
local ts_langs = { "bash", "c", "clojure", "cpp", "fennel", "fish", "haskell", "java", "javascript", "jsdoc", "json", "lua", "nix", "python", "query", "rust", "teal", "toml", "tsx", "typescript", "verilog", "vim" }
|
||||||
|
|
||||||
|
require'nvim-treesitter.install'.compilers = { "gcc" }
|
||||||
require'nvim-treesitter.configs'.setup {
|
require'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = { "bash", "c", "clojure", "cpp", "fennel", "fish", "haskell", "java", "javascript", "jsdoc", "json", "lua", "nix", "python", "query", "rust", "toml" },
|
ensure_installed = ts_langs,
|
||||||
highlight = { enable = true, },
|
highlight = { enable = true, },
|
||||||
textobjects = {
|
textobjects = {
|
||||||
select = {
|
select = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
lookahead = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
["<Leader><Leader>ab"] = "@block.outer" ,
|
["ab"] = "@block.outer" ,
|
||||||
["<Leader><Leader>ib"] = "@block.inner" ,
|
["ib"] = "@block.inner" ,
|
||||||
["<Leader><Leader>aC"] = "@call.outer" ,
|
-- We use M,m for call/conditional as C/c would conflict with textobj-word-column
|
||||||
["<Leader><Leader>iC"] = "@call.inner" ,
|
["aM"] = "@call.outer" ,
|
||||||
["<Leader><Leader>ao"] = "@class.outer" ,
|
["iM"] = "@call.inner" ,
|
||||||
["<Leader><Leader>io"] = "@class.inner" ,
|
["ao"] = "@class.outer" ,
|
||||||
["<Leader><Leader>at"] = "@comment.outer" ,
|
["io"] = "@class.inner" ,
|
||||||
["<Leader><Leader>ac"] = "@conditional.outer",
|
["at"] = "@comment.outer" ,
|
||||||
["<Leader><Leader>ic"] = "@conditional.inner",
|
["am"] = "@conditional.outer",
|
||||||
["<Leader><Leader>af"] = "@function.outer" ,
|
["im"] = "@conditional.inner",
|
||||||
["<Leader><Leader>if"] = "@function.inner" ,
|
["af"] = "@function.outer" ,
|
||||||
["<Leader><Leader>al"] = "@loop.outer" ,
|
["if"] = "@function.inner" ,
|
||||||
["<Leader><Leader>il"] = "@loop.inner" ,
|
["al"] = "@loop.outer" ,
|
||||||
["<Leader><Leader>ap"] = "@parameter.outer" ,
|
["il"] = "@loop.inner" ,
|
||||||
["<Leader><Leader>ip"] = "@parameter.inner" ,
|
["ap"] = "@parameter.outer" ,
|
||||||
["<Leader><Leader>is"] = "@scopename.inner" ,
|
["ip"] = "@parameter.inner" ,
|
||||||
["<Leader><Leader>as"] = "@statement.outer" ,
|
["is"] = "@scopename.inner" ,
|
||||||
|
["as"] = "@statement.outer" ,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
["<Leader>sb"] = "@block.outer" ,
|
||||||
|
["<Leader>sl"] = "@call.outer" ,
|
||||||
|
["<Leader>sc"] = "@class.outer" ,
|
||||||
|
["<Leader>sf"] = "@function.outer" ,
|
||||||
|
["<Leader>sp"] = "@parameter.inner",
|
||||||
|
["<Leader>ss"] = "@statement.outer",
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
["<Leader>sB"] = "@block.outer" ,
|
||||||
|
["<Leader>sL"] = "@call.outer" ,
|
||||||
|
["<Leader>sC"] = "@class.outer" ,
|
||||||
|
["<Leader>sF"] = "@function.outer" ,
|
||||||
|
["<Leader>sP"] = "@parameter.inner",
|
||||||
|
["<Leader>sS"] = "@statement.outer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true,
|
||||||
|
goto_next_start = {
|
||||||
|
["]m"] = "@function.outer",
|
||||||
|
["]s"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
["]M"] = "@function.outer",
|
||||||
|
["]S"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
["[m"] = "@function.outer",
|
||||||
|
["[s"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
["[M"] = "@function.outer",
|
||||||
|
["[S"] = "@class.outer",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -30,11 +78,6 @@ require'nvim-treesitter.configs'.setup {
|
||||||
use_virtual_text = true,
|
use_virtual_text = true,
|
||||||
lint_events = { "BufWrite", "CursorHold" },
|
lint_events = { "BufWrite", "CursorHold" },
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
require'nvim-treesitter.install'.compilers = { "gcc" }
|
|
||||||
|
|
||||||
require "nvim-treesitter.configs".setup {
|
|
||||||
playground = {
|
playground = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = {},
|
disable = {},
|
||||||
|
|
Loading…
Reference in a new issue