Fixed MacOS shortcut

pull/128/head
flin16 2025-05-25 17:39:08 -05:00
parent a08d4386fc
commit daac5007d3
3 changed files with 23 additions and 21 deletions

View File

@ -21,6 +21,7 @@
"mini.ai": { "branch": "main", "commit": "b91997d220086e92edc1fec5ce82094dcc234291" }, "mini.ai": { "branch": "main", "commit": "b91997d220086e92edc1fec5ce82094dcc234291" },
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
"mini.pairs": { "branch": "main", "commit": "69864a2efb36c030877421634487fd90db1e4298" }, "mini.pairs": { "branch": "main", "commit": "69864a2efb36c030877421634487fd90db1e4298" },
"mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" },
"molokai": { "branch": "master", "commit": "c67bdfcdb31415aa0ade7f8c003261700a885476" }, "molokai": { "branch": "master", "commit": "c67bdfcdb31415aa0ade7f8c003261700a885476" },
"neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" },
"neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" },

View File

@ -1,6 +1,7 @@
{ {
"extras": [ "extras": [
"lazyvim.plugins.extras.ai.copilot", "lazyvim.plugins.extras.ai.copilot",
"lazyvim.plugins.extras.coding.mini-surround",
"lazyvim.plugins.extras.coding.yanky", "lazyvim.plugins.extras.coding.yanky",
"lazyvim.plugins.extras.editor.refactoring", "lazyvim.plugins.extras.editor.refactoring",
"lazyvim.plugins.extras.lang.markdown", "lazyvim.plugins.extras.lang.markdown",

View File

@ -10,8 +10,10 @@ end
local function map_all_mode(lhs, rhs, opts) local function map_all_mode(lhs, rhs, opts)
map_nv(lhs, rhs, opts) map_nv(lhs, rhs, opts)
vim.keymap.set("i", lhs, rhs, opts) vim.keymap.set("i", lhs, rhs, opts)
vim.keymap.set("t", lhs, rhs, opts)
end end
map_nv("<BS>", '"_d', { desc = "Delete selection with Del" }) -- TODO: make this work
vim.keymap.set("v", "<BS>", '"_d', { noremap = true, desc = "Delete selection with Backspace" })
map_all_mode("<F5>", function() map_all_mode("<F5>", function()
require("dap").continue() require("dap").continue()
end, { desc = "DAP: Continue" }) end, { desc = "DAP: Continue" })
@ -31,23 +33,21 @@ vim.keymap.set("n", "\\b", function()
require("dap").toggle_breakpoint() require("dap").toggle_breakpoint()
end, { desc = "DAP: Toggle Breakpoint" }) end, { desc = "DAP: Toggle Breakpoint" })
--Git settings -- Now configure shortcuts for MacOS
-- vim.keymap.set("n", "<leader>ga", function() -- if vim.g.neovide then
-- require("Snacks"). vim.keymap.set("n", "<D-s>", ":w<CR>") -- Save
-- end, { desc = "Git: Find files" }) vim.keymap.set("i", "<D-s>", "<C-O>:w<CR>")
map_all_mode("<D-w>", function()
if vim.g.neovide then local success, _ = pcall(function() vim.cmd('tabclose') end)
vim.keymap.set("n", "<D-s>", ":w<CR>") -- Save if not success then
vim.keymap.set("i", "<D-s>", "<C-O>:w<CR>") vim.notify("Cannot close the last tab page", vim.log.levels.WARN)
vim.keymap.set("n", "<D-w>", ":CloseBuffer<CR>") -- Close end
vim.keymap.set("i", "<D-w>", "<C-o>:CloseBuffer<CR>") -- Close end, { desc = "Close current tab" })
vim.keymap.set("i", "<D-z", function() map_all_mode("<D-z>", function() vim.cmd("undo") end)
vim.cmd("undo") vim.keymap.set("i", "<D-v>", '<C-O>"+gP')
end) vim.keymap.set("n", "<D-v>", '"+p', { desc = "Paste from clipboard" })
map_nv("<D-v>", '"+gP', { desc = "Paste from clipboard" }) vim.keymap.set("v", "<D-v>", '"_d"+p', { desc = "Remove the selected part and paste from system clipboard." })
vim.keymap.set("c", "<D-v>", "<C-r>+") -- Paste command mode vim.keymap.set("v", "<D-c>", '"+y', { desc = "Copy to clipboard in visual mode" })
vim.keymap.set("i", "<D-v>", "<C-r>+", { noremap = true, silent = true }) vim.keymap.set("v", "<D-x>", '"+d', { desc = "Cut to clipboard" })
vim.keymap.set("v", "<D-c>", '"+y', { desc = "Copy to clipboard in visual mode" }) map_nv("<D-a>", "gg<S-v>G", { desc = "Select all" })
vim.keymap.set("v", "<D-x>", '"+d', { desc = "Cut to clipboard" }) -- end
map_nv("<D-a>", "gg<S-v>G", { desc = "Select all" })
end