robin/ivy

my custom neovim config

git clone https://git.robinwobin.dev/robin/ivy

robinkeymaps(editor): use `gP` to open the alt file in the preview window8875c87

main
1016 B38 linesraw
1-- quit all
2vim.keymap.set("n", "<leader>q", vim.cmd.quitall)
3-- detach
4vim.keymap.set("n", "<C-z>", vim.cmd.detach)
5
6-- save file without autocmds
7vim.keymap.set(
8  "n",
9  "<C-s>",
10  vim.wrap(vim._with, { noautocmd = true }, vim.wrap(vim.cmd, "write"))
11)
12-- edit alt file (go to previous)
13vim.keymap.set("n", "gp", vim.wrap(vim.cmd.buf, "#"))
14vim.keymap.set("n", "gP", "<cmd>pedit #<cr><c-w>P")
15
16vim.keymap.set("n", "zq", function()
17  local is_qf_open = vim
18    .iter(vim.api.nvim_tabpage_list_wins(0))
19    :find(function(win)
20      local buf = vim.api.nvim_win_get_buf(win)
21      return vim.bo[buf].buftype == "quickfix"
22    end)
23  if is_qf_open then
24    vim.cmd([[cclose]])
25    return
26  end
27  vim.cmd([[botright copen]])
28end, { desc = "toggle quickfix" })
29
30vim.keymap.set("n", "zD", function()
31  if vim.o.diff then
32    vim.cmd([[diffoff]])
33    return
34  end
35  vim.cmd([[diffthis]])
36end, { desc = "toggle diff mode" })
37vim.keymap.set("n", "dzo", "<cmd>%diffget<cr>")
38vim.keymap.set("n", "dzp", "<cmd>%diffput<cr>")