diff --git a/.gitmodules b/.gitmodules index 249adfc..a23a34e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -48,6 +48,10 @@ [submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter"] path = src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter url = https://github.com/nvim-treesitter/nvim-treesitter.git +# intelligent motions based on treesitter +[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects"] + path = src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects + url = https://github.com/nvim-treesitter/nvim-treesitter-textobjects # error/warning/info box # coding.lua diff --git a/src/.config/nvim/lua/coding.lua b/src/.config/nvim/lua/coding.lua index 829399b..4ba4986 100644 --- a/src/.config/nvim/lua/coding.lua +++ b/src/.config/nvim/lua/coding.lua @@ -33,7 +33,7 @@ vim.api.nvim_create_autocmd( -- plug: nvim-treesitter ------ require 'nvim-treesitter.configs'.setup { - ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash" }, + ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash", "lua", "rust" }, sync_install = false, auto_install = false, highlight = { @@ -49,6 +49,25 @@ require 'nvim-treesitter.configs'.setup { }, } +------ +-- treesitter (language intelligent) motions +-- plug: nvim-treesitter-textobjects +------ +require("nvim-treesitter.configs").setup { + textobjects = { + select = { + enable = true, + + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + } + } +} + ------ -- diagnostics box @@ -56,8 +75,8 @@ require 'nvim-treesitter.configs'.setup { ------ require('trouble').setup({ icons = false, - fold_open = "v", -- icon used for open folds - fold_closed = ">", -- icon used for closed folds + fold_open = "v", -- icon used for open folds + fold_closed = ">", -- icon used for closed folds indent_lines = false, -- add an indent guide below the fold icons signs = { -- icons / text used for a diagnostic @@ -140,7 +159,7 @@ local servers = { }, diagnostics = { -- get it to stop complaining about luasnip - globals = {'s', 'f', 't', "fmt", "c", "sn", "i", "rep", "d", "k", "events"}, + globals = { 's', 'f', 't', "fmt", "c", "sn", "i", "rep", "d", "k", "events" }, }, } } diff --git a/src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects b/src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects new file mode 160000 index 0000000..f5183ce --- /dev/null +++ b/src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects @@ -0,0 +1 @@ +Subproject commit f5183cea0fda26126e22e789382c208e7b1120f4