From bb5e0f6ab2cadd75960dd34231eadfdfa0acb16b Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Thu, 10 Oct 2024 13:36:56 -0700 Subject: [PATCH] feat: add incremental selection --- init.lua | 29 +++++++++++++++++++---------- lua/keymaps.lua | 1 + lua/plugins/lz-spec.lua | 1 + 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index e9ef5af..c59802e 100644 --- a/init.lua +++ b/init.lua @@ -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 = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + }, }) 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, }) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 3165297..9ee8c09 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -24,6 +24,7 @@ vim.keymap.set({ "n", "v" }, "P", '"+P', { desc = "put before cursor fro vim.keymap.set("i", "", require("scripts.intellitab").indent) +-- Allow increment/decrement repeatedly in visual vim.keymap.set("v", "", "gv") vim.keymap.set("v", "", "gv") vim.keymap.set("v", "g", "ggv") diff --git a/lua/plugins/lz-spec.lua b/lua/plugins/lz-spec.lua index 625284a..c98ede3 100644 --- a/lua/plugins/lz-spec.lua +++ b/lua/plugins/lz-spec.lua @@ -68,6 +68,7 @@ return { "mini.notify", after = function() require("mini.notify").setup({ + -- handled by statusline lsp_progress = { enable = false }, }) end,