neovim: add remaps for quickfix and location lists

This commit is contained in:
2022-08-22 20:19:05 +03:00
parent 10cf69823a
commit 717e918b03
2 changed files with 20 additions and 1 deletions

View File

@@ -4,7 +4,10 @@ local git = require("daniil.git")
-- General keymaps
vim.keymap.set("n", "<C-c>", ":nohl<CR>")
vim.keymap.set("n", "<C-q>", "<C-W>q")
-- Quickfix and location list remaps
vim.keymap.set("n", "<C-q>", u.toggle_qflist)
vim.keymap.set("n", "<leader>q", u.toggle_locationlist)
-- Disable PageUp and PageDown keys
vim.keymap.set({ "n", "i", "v" }, "<PageDown>", "<nop>")

View File

@@ -109,4 +109,20 @@ function M.open_unsaved_buffers()
end
end
function M.toggle_qflist()
if vim.bo.ft == "qf" then
vim.cmd(":cclose")
else
vim.cmd(":copen")
end
end
function M.toggle_locationlist()
if vim.bo.ft == "qf" then
vim.cmd(":lclose")
else
vim.cmd(":lopen")
end
end
return M