-- quit all vim.keymap.set("n", "q", vim.cmd.quitall) -- detach vim.keymap.set("n", "", vim.cmd.detach) -- save file without autocmds vim.keymap.set( "n", "", vim.wrap(vim._with, { noautocmd = true }, vim.wrap(vim.cmd, "write")) ) -- edit alt file (go to previous) vim.keymap.set("n", "gp", vim.wrap(vim.cmd.buf, "#")) vim.keymap.set("n", "gP", "pedit #P") vim.keymap.set("n", "zq", function() local is_qf_open = vim .iter(vim.api.nvim_tabpage_list_wins(0)) :find(function(win) local buf = vim.api.nvim_win_get_buf(win) return vim.bo[buf].buftype == "quickfix" end) if is_qf_open then vim.cmd([[cclose]]) return end vim.cmd([[botright copen]]) end, { desc = "toggle quickfix" }) vim.keymap.set("n", "zD", function() if vim.o.diff then vim.cmd([[diffoff]]) return end vim.cmd([[diffthis]]) end, { desc = "toggle diff mode" }) vim.keymap.set("n", "dzo", "%diffget") vim.keymap.set("n", "dzp", "%diffput")