diff --git a/lazy-lock.json b/lazy-lock.json index 44396af..42bd496 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -21,6 +21,7 @@ "mini.ai": { "branch": "main", "commit": "b91997d220086e92edc1fec5ce82094dcc234291" }, "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, "mini.pairs": { "branch": "main", "commit": "69864a2efb36c030877421634487fd90db1e4298" }, + "mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" }, "molokai": { "branch": "master", "commit": "c67bdfcdb31415aa0ade7f8c003261700a885476" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, diff --git a/lazyvim.json b/lazyvim.json index 91a7f03..8893f66 100644 --- a/lazyvim.json +++ b/lazyvim.json @@ -1,6 +1,7 @@ { "extras": [ "lazyvim.plugins.extras.ai.copilot", + "lazyvim.plugins.extras.coding.mini-surround", "lazyvim.plugins.extras.coding.yanky", "lazyvim.plugins.extras.editor.refactoring", "lazyvim.plugins.extras.lang.markdown", diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 3322221..beaed99 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -10,8 +10,10 @@ end local function map_all_mode(lhs, rhs, opts) map_nv(lhs, rhs, opts) vim.keymap.set("i", lhs, rhs, opts) + vim.keymap.set("t", lhs, rhs, opts) end -map_nv("", '"_d', { desc = "Delete selection with Del" }) +-- TODO: make this work +vim.keymap.set("v", "", '"_d', { noremap = true, desc = "Delete selection with Backspace" }) map_all_mode("", function() require("dap").continue() end, { desc = "DAP: Continue" }) @@ -31,23 +33,21 @@ vim.keymap.set("n", "\\b", function() require("dap").toggle_breakpoint() end, { desc = "DAP: Toggle Breakpoint" }) ---Git settings --- vim.keymap.set("n", "ga", function() --- require("Snacks"). --- end, { desc = "Git: Find files" }) - -if vim.g.neovide then - vim.keymap.set("n", "", ":w") -- Save - vim.keymap.set("i", "", ":w") - vim.keymap.set("n", "", ":CloseBuffer") -- Close - vim.keymap.set("i", "", ":CloseBuffer") -- Close - vim.keymap.set("i", "", '"+gP', { desc = "Paste from clipboard" }) - vim.keymap.set("c", "", "+") -- Paste command mode - vim.keymap.set("i", "", "+", { noremap = true, silent = true }) - vim.keymap.set("v", "", '"+y', { desc = "Copy to clipboard in visual mode" }) - vim.keymap.set("v", "", '"+d', { desc = "Cut to clipboard" }) - map_nv("", "ggG", { desc = "Select all" }) -end +-- Now configure shortcuts for MacOS +-- if vim.g.neovide then +vim.keymap.set("n", "", ":w") -- Save +vim.keymap.set("i", "", ":w") +map_all_mode("", function() + local success, _ = pcall(function() vim.cmd('tabclose') end) + if not success then + vim.notify("Cannot close the last tab page", vim.log.levels.WARN) + end +end, { desc = "Close current tab" }) +map_all_mode("", function() vim.cmd("undo") end) +vim.keymap.set("i", "", '"+gP') +vim.keymap.set("n", "", '"+p', { desc = "Paste from clipboard" }) +vim.keymap.set("v", "", '"_d"+p', { desc = "Remove the selected part and paste from system clipboard." }) +vim.keymap.set("v", "", '"+y', { desc = "Copy to clipboard in visual mode" }) +vim.keymap.set("v", "", '"+d', { desc = "Cut to clipboard" }) +map_nv("", "ggG", { desc = "Select all" }) +-- end