diff options
author | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-05-20 17:08:02 +0100 |
---|---|---|
committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-05-20 17:08:02 +0100 |
commit | 079c385b9bd40a73ebafae6d847f62c2bed5126c (patch) | |
tree | 95d5e270ac7dab639fe7bca9b7a02041bfadfa47 /home/.config/nvim/lua/custom/plugins/ts.lua | |
parent | 1d6fe632512eca513dab6a8868298df638e50e5e (diff) | |
download | dotfiles-079c385b9bd40a73ebafae6d847f62c2bed5126c.tar.gz dotfiles-079c385b9bd40a73ebafae6d847f62c2bed5126c.tar.bz2 dotfiles-079c385b9bd40a73ebafae6d847f62c2bed5126c.zip |
[nvim] Rewrite config motivated by nvim 0.10
Diffstat (limited to 'home/.config/nvim/lua/custom/plugins/ts.lua')
-rw-r--r-- | home/.config/nvim/lua/custom/plugins/ts.lua | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/home/.config/nvim/lua/custom/plugins/ts.lua b/home/.config/nvim/lua/custom/plugins/ts.lua new file mode 100644 index 0000000..33c6ca8 --- /dev/null +++ b/home/.config/nvim/lua/custom/plugins/ts.lua @@ -0,0 +1,148 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + "nvim-treesitter/nvim-treesitter-refactor", + "RRethy/nvim-treesitter-textsubjects", + "theHamsta/nvim-treesitter-pairs", + "RRethy/nvim-treesitter-endwise", + }, + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "c", + "cmake", + "comment", + "cpp", + "css", + "cuda", + "diff", + "dockerfile", + "fortran", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "go", + "html", + "javascript", + "jsdoc", + "json", + "llvm", + "lua", + "make", + "markdown", + "markdown_inline", + "ninja", + "python", + "regex", + "rust", + "sql", + "todotxt", + "toml", + "typescript", + "vim", + "vimdoc", + "yaml" + }, + -- ignore_install = { "phpdoc" }, + highlight = { + enable = true, -- false will disable the whole extension + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + indent = { enable = true }, + refactor = { + highlight_definitions = { enable = true }, + highlight_current_scope = { enable = true }, + smart_rename = { enable = true, keymaps = { smart_rename = "grr" } }, + navigation = { + enable = true, + keymaps = { + goto_definition = "gnd", + list_definitions = "gnD", + list_definitions_toc = "gO", + goto_next_usage = "<a-*>", + goto_previous_usage = "<a-#>", + }, + }, + }, + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + swap = { + enable = true, + swap_next = { ["<leader>a"] = "@parameter.inner" }, + swap_previous = { ["<leader>A"] = "@parameter.inner" }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + lsp_interop = { + enable = true, + peek_definition_code = { + ["df"] = "@function.outer", + ["dF"] = "@class.outer", + }, + }, + }, + matchup = { + enable = true, + }, + pairs = { + enable = true, + goto_right_end = false, + keymaps = { goto_partner = "%" }, + }, + textsubjects = { + enable = true, + keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" }, + }, + tree_docs = { + enable = true, + }, + endwise = { + enable = true, + }, + }) + end + }, +} |