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,21 +21,30 @@ vim.opt.foldenable = false
vim.cmd.colorscheme("rose-pine")
require('nvim-treesitter.configs').setup({
require("nvim-treesitter.configs").setup({
ensure_installed = {},
sync_install = false,
auto_install = false,
modules = {"highlight", "incremental_selection", "indent"},
modules = { "highlight", "incremental_selection", "indent" },
ignore_install = {},
highlight = { enable = true },
disable = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
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({
@ -43,12 +52,12 @@ vim.api.nvim_create_autocmd({
}, {
group = vim.api.nvim_create_augroup("terminal", {}),
callback = function()
vim.cmd("setlocal nonumber norelativenumber")
vim.cmd("setlocal nonumber norelativenumber")
end,
})
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank {higroup='Visual', timeout=300}
vim.highlight.on_yank({ higroup = "Visual", timeout = 300 })
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)
-- Allow increment/decrement repeatedly in visual
vim.keymap.set("v", "<C-a>", "<C-a>gv")
vim.keymap.set("v", "<C-x>", "<C-x>gv")
vim.keymap.set("v", "g<C-a>", "g<C-a>gv")

View file

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