diff --git a/KEYMAPS.md b/KEYMAPS.md index 8fcb982..7ddb509 100644 --- a/KEYMAPS.md +++ b/KEYMAPS.md @@ -33,11 +33,6 @@ |-----|--------| | `ha` | Add current file to harpoon | | `hh` | Open harpoon menu | -| `1` | Jump to harpoon file 1 | -| `2` | Jump to harpoon file 2 | -| `3` | Jump to harpoon file 3 | -| `4` | Jump to harpoon file 4 | -| `5` | Jump to harpoon file 5 | | `hp` | Previous harpoon file | | `hn` | Next harpoon file | @@ -123,8 +118,6 @@ Inside nvim-tree: | `y` | n, x | Yank | | `p` | n, x | Put after | | `P` | n, x | Put before | -| `` | n | Previous yank in ring | -| `` | n | Next yank in ring | | `yh` | n | Open yank history | | `]p` | n | Put indented after | | `[p` | n | Put indented before | diff --git a/lua/cargdev/core/options.lua b/lua/cargdev/core/options.lua index 4e4ebbc..65a0b06 100644 --- a/lua/cargdev/core/options.lua +++ b/lua/cargdev/core/options.lua @@ -17,6 +17,7 @@ opt.swapfile = false -- Don't create swap files opt.completeopt = "menuone,noselect" -- Better completion opt.undofile = true -- Persistent undo opt.undodir = vim.fn.stdpath("data") .. "/undodir" +opt.autoread = true -- Auto-reload files when changed externally -- Suppress startup messages to avoid "Press ENTER" prompts opt.shortmess = "aoOtTIcFWS" -- Suppress various messages @@ -214,6 +215,28 @@ for _, plugin in pairs(disabled_built_ins) do g["loaded_" .. plugin] = 1 end +-- ============================================================================= +-- AUTO-RELOAD FILES WHEN CHANGED EXTERNALLY +-- ============================================================================= + +-- Trigger checktime when switching buffers or focusing Neovim +vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, { + pattern = "*", + callback = function() + if vim.fn.mode() ~= "c" then + vim.cmd("checktime") + end + end, +}) + +-- Notify when file is reloaded +vim.api.nvim_create_autocmd("FileChangedShellPost", { + pattern = "*", + callback = function() + vim.notify("File changed on disk. Buffer reloaded.", vim.log.levels.WARN) + end, +}) + -- ============================================================================= -- OPTIMIZED AUTO WRAPPER AUTOCMDS -- ============================================================================= diff --git a/lua/cargdev/plugins/harpoon.lua b/lua/cargdev/plugins/harpoon.lua index 18e8522..7cf0a13 100644 --- a/lua/cargdev/plugins/harpoon.lua +++ b/lua/cargdev/plugins/harpoon.lua @@ -16,18 +16,19 @@ return { }) -- Keymaps - vim.keymap.set("n", "ha", function() harpoon:list():add() end, { desc = "Harpoon add file" }) - vim.keymap.set("n", "hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = "Harpoon menu" }) - - -- Quick navigation to harpooned files - vim.keymap.set("n", "1", function() harpoon:list():select(1) end, { desc = "Harpoon file 1" }) - vim.keymap.set("n", "2", function() harpoon:list():select(2) end, { desc = "Harpoon file 2" }) - vim.keymap.set("n", "3", function() harpoon:list():select(3) end, { desc = "Harpoon file 3" }) - vim.keymap.set("n", "4", function() harpoon:list():select(4) end, { desc = "Harpoon file 4" }) - vim.keymap.set("n", "5", function() harpoon:list():select(5) end, { desc = "Harpoon file 5" }) + vim.keymap.set("n", "ha", function() + harpoon:list():add() + end, { desc = "Harpoon add file" }) + vim.keymap.set("n", "hh", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = "Harpoon menu" }) -- Navigate between harpooned files - vim.keymap.set("n", "hp", function() harpoon:list():prev() end, { desc = "Harpoon prev" }) - vim.keymap.set("n", "hn", function() harpoon:list():next() end, { desc = "Harpoon next" }) + vim.keymap.set("n", "hp", function() + harpoon:list():prev() + end, { desc = "Harpoon prev" }) + vim.keymap.set("n", "hn", function() + harpoon:list():next() + end, { desc = "Harpoon next" }) end, } diff --git a/lua/cargdev/plugins/vim-visual-multi.lua b/lua/cargdev/plugins/vim-visual-multi.lua index 5f17f22..ff55e4d 100644 --- a/lua/cargdev/plugins/vim-visual-multi.lua +++ b/lua/cargdev/plugins/vim-visual-multi.lua @@ -15,11 +15,15 @@ return { ["Add Cursor Down"] = "", -- Like VS Code ["Add Cursor Up"] = "", -- Like VS Code ["Skip Region"] = "", -- Skip current and go to next - ["Remove Region"] = "", -- Remove current cursor + ["Remove Region"] = "", -- Remove current cursor (changed from C-p) ["Undo"] = "u", ["Redo"] = "", } + -- Disable C-n and C-p in vim-visual-multi (reserved for buffer navigation) + vim.g.VM_maps["Select Cursor Down"] = "" + vim.g.VM_maps["Select Cursor Up"] = "" + -- Highlight settings vim.g.VM_Mono_hl = "DiffText" vim.g.VM_Extend_hl = "DiffAdd" diff --git a/lua/cargdev/plugins/yanky.lua b/lua/cargdev/plugins/yanky.lua index 7509b03..0cabe93 100644 --- a/lua/cargdev/plugins/yanky.lua +++ b/lua/cargdev/plugins/yanky.lua @@ -36,8 +36,6 @@ return { { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put before" }, { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "GPut after" }, { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "GPut before" }, - { "", "(YankyPreviousEntry)", desc = "Previous yank" }, - { "", "(YankyNextEntry)", desc = "Next yank" }, { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put indented after" }, { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put indented before" }, { "yh", "YankyRingHistory", desc = "Yank history" },