diff --git a/lua/core/keys.lua b/lua/core/keys.lua index 864028f..2d6d935 100644 --- a/lua/core/keys.lua +++ b/lua/core/keys.lua @@ -14,6 +14,7 @@ vim.g.maplocalleader = ' ' -- normal_mode = "n", insert_mode = "i", visual_mode = "v", -- visual_block_mode = "x", term_mode = "t", command_mode = "c", + -- Use jj as escape map('i', 'jj', '', opts) map('i', 'jk', '', opts) @@ -76,6 +77,7 @@ map('n', '', 'yyp', { desc = 'Duplicate line down' }) map('v', '', "y'', "y'>pgv", { desc = 'Duplicate selection down' }) + -- Line manipulation map('n', '', '>>', { desc = 'Indent line' }) map('n', '', '<<', { desc = 'Unindent line' }) @@ -148,152 +150,5 @@ map('v', '{', 's{}Pll', { desc = 'wrap selection with curly braces' map('v', "'", "s''Pll", { desc = 'wrap selection with single quotes' }) map('v', '"', 's""Pll', { desc = 'wrap selection with double quotes' }) -local function map(mode, lhs, rhs, opts) - opts = opts or {} - opts.silent = opts.silent ~= false - vim.keymap.set(mode, lhs, rhs, opts) -end -local opts = { noremap = true, silent = true } --- Space as leader -map('n', '', '', opts) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' --- Modes --- normal_mode = "n", insert_mode = "i", visual_mode = "v", --- visual_block_mode = "x", term_mode = "t", command_mode = "c", - --- Use jj as escape -map('i', 'jj', '', opts) -map('i', 'jk', '', opts) -map('i', 'kj', '', opts) -map('t', 'JJ', '', opts) - --- Terminal Mappings -map('t', 'jk', '') -map('t', 'kj', '') -map('t', '', '') - --- Visual overwrite paste -map({ 'v', 'x' }, 'p', '"_dP', opts) - --- Do not copy on x -map({ 'v', 'x' }, 'x', '"_x', opts) - --- VSCode style shortcuts --- File operations -map('n', '', ':w', { desc = 'Save file' }) -map('i', '', ':wa', { desc = 'Save file' }) -map('n', '', ':q', { desc = 'Quit' }) -map('n', '', ':bd', { desc = 'Close buffer' }) - --- Undo/Redo -map('n', '', 'u', { desc = 'Undo' }) -map('i', '', 'u', { desc = 'Undo' }) -map('n', '', '', { desc = 'Redo' }) -map('i', '', '', { desc = 'Redo' }) - --- Select all -map('n', '', 'ggVG', { desc = 'Select all' }) -map('i', '', 'ggVG', { desc = 'Select all' }) - --- Copy/Cut -map('v', '', 'y', { desc = 'Copy' }) -map('v', '', 'd', { desc = 'Cut' }) - --- Line operations (VSCode style) -map('n', '', ':m .-2==', { desc = 'Move line up' }) -map('n', '', ':m .+1==', { desc = 'Move line down' }) -map('i', '', ':m .-2==gi', { desc = 'Move line up' }) -map('i', '', ':m .+1==gi', { desc = 'Move line down' }) -map('v', '', ":m '<-2gv=gv", { desc = 'Move selection up' }) -map('v', '', ":m '>+1gv=gv", { desc = 'Move selection down' }) - --- VSCode-style line operations -map('n', '', 'o', { desc = 'Insert line below' }) -map('i', '', 'o', { desc = 'Insert line below' }) - --- Quick word operations -map('n', '', 'db', { desc = 'Delete word backward' }) -map('i', '', '', { desc = 'Delete word backward' }) -map('n', '', 'dw', { desc = 'Delete word forward' }) -map('i', '', 'dw', { desc = 'Delete word forward' }) - --- Duplicate line -map('n', '', 'yykP', { desc = 'Duplicate line up' }) -map('n', '', 'yyp', { desc = 'Duplicate line down' }) -map('v', '', "y'', "y'>pgv", { desc = 'Duplicate selection down' }) - --- Line manipulation -map('n', '', '>>', { desc = 'Indent line' }) -map('n', '', '<<', { desc = 'Unindent line' }) -map('i', '', '>>', { desc = 'Indent line' }) -map('i', '', '<<', { desc = 'Unindent line' }) - --- Visual overwrite paste -map({ 'v', 'x' }, 'p', '"_dP', opts) - --- Do not copy on x -map({ 'v', 'x' }, 'x', '"_x', opts) -map('n', 'X', '"_D', opts) -map({ 'v', 'x' }, 'X', '"_d', opts) - --- Increment/decrement -map({ 'n', 'v', 'x' }, '-', '', opts) -map({ 'n', 'v', 'x' }, '=', '', opts) - --- Move to line beginning and end -map({ 'n', 'v', 'x' }, 'gl', '$', { desc = 'End of line' }) -map({ 'n', 'v', 'x' }, 'gh', '^', { desc = 'Beginning of line' }) - --- Center Cursors -map('n', 'J', 'mzJ`z', opts) -map('n', '', 'zz', opts) -map('n', '', 'zz', opts) -map('n', 'n', 'nzzzv', opts) -map('n', 'N', 'Nzzzv', opts) - --- Better up/down -map('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) - --- Move text up and down -map({ 'v', 'x' }, 'J', ":move '>+1gv-gv", opts) -map({ 'v', 'x' }, 'K', ":move '<-2gv-gv", opts) - --- Clear search, diff update and redraw -map({ 'i', 'n' }, '', 'noh', { desc = 'Escape and clear hlsearch' }) - --- Consistent n/N search navigation -map('n', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('n', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) -map('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) -map('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) - --- Better indenting -map('v', '<', '', '>gv') - --- Add undo breakpoints -map('i', ',', ',u') -map('i', '.', '.u') -map('i', ';', ';u') - -map('n', 'd', '"_d', { desc = 'Delete without replacing clipboard' }) -map('n', 'x', '"_x', { desc = 'Cut without replacing clipboard' }) -map('n', 'c', '"_c', { desc = 'Change without replacing clipboard' }) -map('v', 'p', '"_dP', { desc = 'Paste without replacing clipboard' }) - --- Toggle relative numbers off or on (for code presentation) -map({ 'n', 'v' }, 'tn', 'set rnu!', {}) - ---insert the following characters around the visual selection -map('v', '(', 's()Pll', { desc = 'wrap selection with parens' }) -map('v', '[', 's[]Pll', { desc = 'wrap selection with square braces' }) -map('v', '{', 's{}Pll', { desc = 'wrap selection with curly braces' }) -map('v', "'", "s''Pll", { desc = 'wrap selection with single quotes' }) -map('v', '"', 's""Pll', { desc = 'wrap selection with double quotes' }) diff --git a/lua/core/options.lua b/lua/core/options.lua index ca391db..aa89df5 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -51,7 +51,7 @@ local options = { undofile = true, -- enable persistent undo undodir = vim.fn.stdpath('cache') .. '/undo', undolevels = 10000, - updatetime = 50, -- faster completion (4000ms default) + updatetime = 250, -- balance between responsiveness and performance wildmenu = true, -- wildmenu wildmode = 'longest:full,full', -- Command-line completion mode winminwidth = 5, -- Minimum window width diff --git a/lua/plugins/ai/avante.lua b/lua/plugins/ai/avante.lua index fb36dfc..9e9e5cd 100644 --- a/lua/plugins/ai/avante.lua +++ b/lua/plugins/ai/avante.lua @@ -32,7 +32,7 @@ avante.setup({ provider = 'copilot-claude-3.5-sonnet', -- cursor_applying_provider = 'copilot-o3-mini', -- auto_suggestions_provider = 'copilot-claude-3.7-sonnet', - + providers = vim.tbl_extend('force', { copilot = { endpoint = 'https://api.githubcopilot.com', @@ -43,7 +43,7 @@ avante.setup({ }, max_completion_tokens = 1000000, reasoning_effort = 'high', - }, + } }, generate_providers()), behaviour = { diff --git a/lua/plugins/ai/mcphub.lua b/lua/plugins/ai/mcphub.lua index 9bbeafb..a41cafe 100644 --- a/lua/plugins/ai/mcphub.lua +++ b/lua/plugins/ai/mcphub.lua @@ -37,4 +37,4 @@ mcphub.setup({ file_path = vim.fn.stdpath('state') .. '/mcphub.log', prefix = 'MCPHub', }, -}) +}) \ No newline at end of file diff --git a/lua/plugins/editor/treesitter.lua b/lua/plugins/editor/treesitter.lua index a22ad24..6e96271 100644 --- a/lua/plugins/editor/treesitter.lua +++ b/lua/plugins/editor/treesitter.lua @@ -24,7 +24,7 @@ treesitter.setup({ highlight = { enable = true, disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB + local max_filesize = 1000 * 1024 -- 1 MB instead of 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 diff --git a/lua/plugins/lang/lspconfig.lua b/lua/plugins/lang/lspconfig.lua index ed12414..cef4cdd 100644 --- a/lua/plugins/lang/lspconfig.lua +++ b/lua/plugins/lang/lspconfig.lua @@ -12,9 +12,16 @@ local default_setup = function(server) if server == 'tailwindcss' then lspconfig[server].setup({ capabilities = capabilities, - filetypes = { - 'html', 'css', 'scss', 'javascript', 'javascriptreact', - 'typescript', 'typescriptreact', 'vue', 'svelte' + filetypes = { + 'html', + 'css', + 'scss', + 'javascript', + 'javascriptreact', + 'typescript', + 'typescriptreact', + 'vue', + 'svelte', }, init_options = { userLanguages = { diff --git a/lua/plugins/list.lua b/lua/plugins/list.lua index 97775b8..60028d7 100644 --- a/lua/plugins/list.lua +++ b/lua/plugins/list.lua @@ -169,7 +169,7 @@ local plugins = { 'ravitemer/mcphub.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, cmd = 'MCPHub', - -- build = "npm install -g mcp-hub@latest", -- use this if you want to use the global mcp-hub + -- build = 'npm install -g mcp-hub@latest', -- use this if you want to use the global mcp-hub build = 'bundled_build.lua', config = load_config('ai.mcphub'), }, @@ -235,6 +235,23 @@ local plugins = { }, }, }, + { + 'gbprod/substitute.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local substitute = require('substitute') + + substitute.setup() + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set('n', 's', substitute.operator, { desc = 'Substitute with motion' }) + keymap.set('n', 'ss', substitute.line, { desc = 'Substitute line' }) + keymap.set('n', 'S', substitute.eol, { desc = 'Substitute to end of line' }) + keymap.set('x', 's', substitute.visual, { desc = 'Substitute in visual mode' }) + end, + }, { 'numToStr/Navigator.nvim', config = load_config('tools.navigator'), diff --git a/lua/plugins/lock.json b/lua/plugins/lock.json index 33b090f..f1979a1 100644 --- a/lua/plugins/lock.json +++ b/lua/plugins/lock.json @@ -1,30 +1,30 @@ { - "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, - "avante.nvim": { "branch": "main", "commit": "1c4e0621995480c7c8644751908fd9ac9cd59e90" }, + "avante.nvim": { "branch": "main", "commit": "fdf4716ec04cf5d9f8f39a44b7d42ab37cc2bd40" }, "blink-cmp-avante": { "branch": "master", "commit": "ddefb8de3cb1286ab39e0ccec0f32a45d03391f2" }, "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, "ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" }, "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, "comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" }, - "copilot.lua": { "branch": "master", "commit": "5f726c8e6bbcd7461ee0b870d4e6c8a973b55b64" }, + "copilot.lua": { "branch": "master", "commit": "c1bb86abbed1a52a11ab3944ef00c8410520543d" }, "esqueleto.nvim": { "branch": "main", "commit": "d495d8aecf6d8cc87b8f9b82276cd88393ce014b" }, "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" }, + "gitsigns.nvim": { "branch": "main", "commit": "731b581428ec6c1ccb451b95190ebbc6d7006db7" }, "hardtime.nvim": { "branch": "main", "commit": "5d9adcbe2f12741de79e435c8b85dca69a3b22e4" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markit.nvim": { "branch": "main", "commit": "9b031afab214aa6e6467f275f55640989f438925" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "60eaff7a470b8e78ddff09d847d17a011f560759" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "bef29b653ba71d442816bf56286c2a686210be04" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mcphub.nvim": { "branch": "main", "commit": "ac5c366b9572ece2782d4765f14d69574e715415" }, + "mcphub.nvim": { "branch": "main", "commit": "4888f27a2c0122d351a337e7576797f4a63df166" }, "mini.ai": { "branch": "main", "commit": "e139eb1101beb0250fea322f8c07a42f0f175688" }, "mini.bracketed": { "branch": "main", "commit": "079b8375e40ebf3f8af319ad835263ff390c3965" }, "mini.files": { "branch": "main", "commit": "49c855977e9f4821d1ed8179ed44fe098b93ea2a" }, @@ -33,10 +33,10 @@ "neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, "neotypist.nvim": { "branch": "master", "commit": "23570aedca4bb4d92967ac82e053cf4d4903abe9" }, "none-ls.nvim": { "branch": "main", "commit": "db2a48b79cfcdab8baa5d3f37f21c78b6705c62e" }, - "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, "nvim-dbee": { "branch": "master", "commit": "9656fc59841291e9dbd2f3b50b1cb4c77d9fea79" }, - "nvim-lspconfig": { "branch": "master", "commit": "4315a9686f4d21a521d89a693e02947d1e119f5d" }, + "nvim-lspconfig": { "branch": "master", "commit": "583a1d555c8e407868ce00c57e37eca4b7ff960e" }, "nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" }, "nvim-spider": { "branch": "main", "commit": "99df646eab60df0b948dd2532ef5f5512707a9a4" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, @@ -50,9 +50,10 @@ "pickme.nvim": { "branch": "main", "commit": "70e8c040a6c01b34a6a7e05aff6ebb241211fc6d" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, - "smear-cursor.nvim": { "branch": "main", "commit": "162703638203060b1d3412e73429d232bbd2627e" }, + "smear-cursor.nvim": { "branch": "main", "commit": "aff844fc1483fd673f721a41affcd7e2fcb885f5" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "sniprun": { "branch": "master", "commit": "a90c65846c3c18efc3f799d8b6dc26af9d4a69ed" }, + "substitute.nvim": { "branch": "main", "commit": "9db749a880e3dd3b0eb57f698aa8f1e1630e1f25" }, "termim.nvim": { "branch": "main", "commit": "6bb3f8fb5a3c64ca614d7c4782d4965863c41675" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "utils.nvim": { "branch": "main", "commit": "0e545d194b8eab9870da8e3cdc728fbcfa6a5a19" }, diff --git a/lua/plugins/ui/snacks.lua b/lua/plugins/ui/snacks.lua index 3374854..a1874ec 100644 --- a/lua/plugins/ui/snacks.lua +++ b/lua/plugins/ui/snacks.lua @@ -59,7 +59,7 @@ Snacks.setup({ bigfile = { enabled = true, notify = true, - size = 100 * 1024, -- 100 KB + size = 1000 * 1024, -- 1 MB instead of 100 KB }, bufdelete = { enabled = true }, dashboard = { @@ -288,7 +288,7 @@ Snacks.setup({ }, scroll = { enabled = false }, statuscolumn = { - enabled = true, + enabled = false, -- Change this to false left = { 'mark', 'sign' }, right = { 'fold', 'git' }, folds = { diff --git a/lua/plugins/ui/which-key.lua b/lua/plugins/ui/which-key.lua index 7b5ce89..bd50fdd 100644 --- a/lua/plugins/ui/which-key.lua +++ b/lua/plugins/ui/which-key.lua @@ -434,8 +434,8 @@ local no_leader_mappings = { { '', ':bprevious', desc = 'Previous Buffer' }, { '', ':bnext', desc = 'Next Buffer' }, - { '', ':bprevious', desc = 'Previous Buffer' }, - { '', ':bnext', desc = 'Next Buffer' }, + { '', ':bnext', desc = 'Next Buffer' }, + { '', ':bprevious', desc = 'Previous Buffer' }, { 'K', ':Lspsaga hover_doc', desc = 'LSP Hover' }, { 'Q', ':qall!', desc = 'Force Quit!' },