nvim: remove treesitter textobjects, add incremental selection binds

This commit is contained in:
dogeystamp 2024-09-14 22:08:33 -04:00
parent 05396378cf
commit bad85da7b6
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
5 changed files with 15 additions and 45 deletions

7
.gitmodules vendored
View File

@ -39,10 +39,6 @@
[submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-treesitter"] [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 path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter
url = https://github.com/nvim-treesitter/nvim-treesitter.git 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 # plain-text-accounting ledger ftplugin
# ftplugin/ledger.vim # ftplugin/ledger.vim
@ -107,9 +103,6 @@
[submodule "submodule.src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-treesitter.path"] [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 path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-treesitter
url = https://github.com/nvim-treesitter/nvim-treesitter.git 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"] [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 path = src/dot_local/share/nvim/site/pack/3pp/start/external_vim-ledger
url = https://github.com/ledger/vim-ledger.git url = https://github.com/ledger/vim-ledger.git

View File

@ -28,6 +28,7 @@ xkblayout-state
xss-lock xss-lock
qutebrowser qutebrowser
neovim neovim
tree-sitter-grammars
tmux tmux
fish fish
ffmpeg ffmpeg

View File

@ -42,21 +42,6 @@ vim.cmd.packadd("vim-gitgutter")
vim.cmd.packadd("nvim-treesitter") vim.cmd.packadd("nvim-treesitter")
require 'nvim-treesitter.configs'.setup { require 'nvim-treesitter.configs'.setup {
ensure_installed = {
"c",
"cpp",
"javascript",
"typescript",
"python",
"vim",
"fish",
"bash",
"lua",
"rust",
"query",
"typst",
"toml",
},
sync_install = false, sync_install = false,
auto_install = false, auto_install = false,
highlight = { highlight = {
@ -70,6 +55,18 @@ require 'nvim-treesitter.configs'.setup {
end end
end, end,
}, },
indent = {
enable = true
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>", -- set to `false` to disable one of the mappings
scope_incremental = "<CR>",
node_incremental = "<TAB>",
node_decremental = "<S-TAB>",
},
},
} }
-- code folding -- code folding
@ -77,30 +74,10 @@ vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.wo.foldlevel = 99 -- unfold by default 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 -- diagnostics box
------ ------
keymap('<leader>dx', vim.diagnostic.open_float, { noremap=true, silent=true }) keymap('<leader>dx', vim.diagnostic.open_float, { noremap = true, silent = true })
-------------------------------- --------------------------------

View File

@ -10,8 +10,8 @@ M = {}
---Hacky debug print utility (do not use outside testing) ---Hacky debug print utility (do not use outside testing)
---@param s any Thing to print ---@param s any Thing to print
---@param pre string? Message that goes before thing ---@param pre string? Message that goes before thing
---@diagnostic disable-next-line: unused-function, unused-local
---@deprecated ---@deprecated
---@diagnostic disable-next-line: unused-function, unused-local
local function dbg_print(s, pre) local function dbg_print(s, pre)
vim.system({ "sh", "-c", string.format("echo '%s' >> /tmp/nvim_scope_log", (pre or "") .. vim.inspect(s)) }) vim.system({ "sh", "-c", string.format("echo '%s' >> /tmp/nvim_scope_log", (pre or "") .. vim.inspect(s)) })
end end

@ -1 +0,0 @@
Subproject commit ca93cb2c34b67ab22d01976fc90bc95627a3317f