From bad85da7b69dbf55ac36097ca891ed614105aece Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sat, 14 Sep 2024 22:08:33 -0400 Subject: [PATCH] nvim: remove treesitter textobjects, add incremental selection binds --- .gitmodules | 7 --- programs | 1 + src/dot_config/nvim/lua/coding.lua | 49 +++++-------------- src/dot_config/nvim/lua/scope.lua | 2 +- .../opt/external_nvim-treesitter-textobjects | 1 - 5 files changed, 15 insertions(+), 45 deletions(-) delete mode 160000 src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter-textobjects diff --git a/.gitmodules b/.gitmodules index c28f15a..cd97582 100644 --- a/.gitmodules +++ b/.gitmodules @@ -39,10 +39,6 @@ [submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-treesitter"] path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter url = https://github.com/nvim-treesitter/nvim-treesitter.git -# intelligent motions based on treesitter -[submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-treesitter-textobjects"] - path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter-textobjects - url = https://github.com/nvim-treesitter/nvim-treesitter-textobjects # plain-text-accounting ledger ftplugin # ftplugin/ledger.vim @@ -107,9 +103,6 @@ [submodule "submodule.src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-treesitter.path"] path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter url = https://github.com/nvim-treesitter/nvim-treesitter.git -[submodule "submodule.src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-treesitter-textobjects.path"] - path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter-textobjects - url = https://github.com/nvim-treesitter/nvim-treesitter-textobjects [submodule "submodule.src/dot_local/share/nvim/site/pack/3pp/start/external_vim-ledger.path"] path = src/dot_local/share/nvim/site/pack/3pp/start/external_vim-ledger url = https://github.com/ledger/vim-ledger.git diff --git a/programs b/programs index 4502733..ea5eef3 100644 --- a/programs +++ b/programs @@ -28,6 +28,7 @@ xkblayout-state xss-lock qutebrowser neovim +tree-sitter-grammars tmux fish ffmpeg diff --git a/src/dot_config/nvim/lua/coding.lua b/src/dot_config/nvim/lua/coding.lua index 395ae66..c329bcb 100644 --- a/src/dot_config/nvim/lua/coding.lua +++ b/src/dot_config/nvim/lua/coding.lua @@ -42,21 +42,6 @@ vim.cmd.packadd("vim-gitgutter") vim.cmd.packadd("nvim-treesitter") require 'nvim-treesitter.configs'.setup { - ensure_installed = { - "c", - "cpp", - "javascript", - "typescript", - "python", - "vim", - "fish", - "bash", - "lua", - "rust", - "query", - "typst", - "toml", - }, sync_install = false, auto_install = false, highlight = { @@ -70,6 +55,18 @@ require 'nvim-treesitter.configs'.setup { end end, }, + indent = { + enable = true + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", -- set to `false` to disable one of the mappings + scope_incremental = "", + node_incremental = "", + node_decremental = "", + }, + }, } -- code folding @@ -77,30 +74,10 @@ vim.wo.foldmethod = 'expr' vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' vim.wo.foldlevel = 99 -- unfold by default ------- --- treesitter (language intelligent) motions ------- -vim.cmd.packadd("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 ------ -keymap('dx', vim.diagnostic.open_float, { noremap=true, silent=true }) +keymap('dx', vim.diagnostic.open_float, { noremap = true, silent = true }) -------------------------------- diff --git a/src/dot_config/nvim/lua/scope.lua b/src/dot_config/nvim/lua/scope.lua index 4955550..c3627d1 100644 --- a/src/dot_config/nvim/lua/scope.lua +++ b/src/dot_config/nvim/lua/scope.lua @@ -10,8 +10,8 @@ M = {} ---Hacky debug print utility (do not use outside testing) ---@param s any Thing to print ---@param pre string? Message that goes before thing ----@diagnostic disable-next-line: unused-function, unused-local ---@deprecated +---@diagnostic disable-next-line: unused-function, unused-local local function dbg_print(s, pre) vim.system({ "sh", "-c", string.format("echo '%s' >> /tmp/nvim_scope_log", (pre or "") .. vim.inspect(s)) }) end diff --git a/src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter-textobjects b/src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter-textobjects deleted file mode 160000 index ca93cb2..0000000 --- a/src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter-textobjects +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ca93cb2c34b67ab22d01976fc90bc95627a3317f