feat: add incremental selection

This commit is contained in:
Youwen Wu 2024-10-10 13:36:56 -07:00
parent 5bc75d0632
commit bb5e0f6ab2
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
3 changed files with 21 additions and 10 deletions

View file

@ -21,7 +21,7 @@ vim.opt.foldenable = false
vim.cmd.colorscheme("rose-pine") vim.cmd.colorscheme("rose-pine")
require('nvim-treesitter.configs').setup({ require("nvim-treesitter.configs").setup({
ensure_installed = {}, ensure_installed = {},
sync_install = false, sync_install = false,
auto_install = false, auto_install = false,
@ -35,7 +35,16 @@ require('nvim-treesitter.configs').setup({
return true return true
end end
end, end,
additional_vim_regex_highlighting = false additional_vim_regex_highlighting = false,
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>",
node_incremental = "<C-k>",
scope_incremental = "<BS>",
node_decremental = "<C-j>",
},
},
}) })
vim.api.nvim_create_autocmd({ vim.api.nvim_create_autocmd({
@ -49,6 +58,6 @@ vim.api.nvim_create_autocmd({
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {
callback = function() callback = function()
vim.highlight.on_yank {higroup='Visual', timeout=300} vim.highlight.on_yank({ higroup = "Visual", timeout = 300 })
end, end,
}) })

View file

@ -24,6 +24,7 @@ vim.keymap.set({ "n", "v" }, "<leader>P", '"+P', { desc = "put before cursor fro
vim.keymap.set("i", "<Tab>", require("scripts.intellitab").indent) vim.keymap.set("i", "<Tab>", require("scripts.intellitab").indent)
-- Allow increment/decrement repeatedly in visual
vim.keymap.set("v", "<C-a>", "<C-a>gv") vim.keymap.set("v", "<C-a>", "<C-a>gv")
vim.keymap.set("v", "<C-x>", "<C-x>gv") vim.keymap.set("v", "<C-x>", "<C-x>gv")
vim.keymap.set("v", "g<C-a>", "g<C-a>gv") vim.keymap.set("v", "g<C-a>", "g<C-a>gv")

View file

@ -68,6 +68,7 @@ return {
"mini.notify", "mini.notify",
after = function() after = function()
require("mini.notify").setup({ require("mini.notify").setup({
-- handled by statusline
lsp_progress = { enable = false }, lsp_progress = { enable = false },
}) })
end, end,