-- Navigate qflist with and . vim.keymap.set("n", "", "cnextzz") vim.keymap.set("n", "", "cprevzz") -- Add all diagnostics to the qflist with grq. vim.keymap.set("n", "grq", function() vim.diagnostic.setqflist({ open = false }) pcall(vim.cmd.cc) end) -- Toggle the qflist window with q. vim.keymap.set("n", "q", function() vim.cmd(vim.fn.getqflist({ winid = 0 }).winid ~= 0 and "cclose" or "copen") end) -- Add all completion alternatives on the command line to the qflist. Mostly -- used with `:find`. For example, do `:find something`, hit tab to show -- possible completions, then to add them all to the qflist. vim.keymap.set("c", "", function() vim.fn.setqflist(vim.tbl_map(function(match) return { filename = match, text = match } end, vim.fn.getcompletion(vim.fn.getcmdline(), "cmdline"))) vim.api.nvim_input("") vim.schedule(function() pcall(vim.cmd.cc) end) end) -- Show the current error in the command line after `:make`. vim.api.nvim_create_autocmd("QuickFixCmdPost", { pattern = "make", callback = function() vim.schedule(function() pcall(vim.cmd.cc) end) end, }) -- In the qflist window, disable numbers, enable cursorline and increase window -- height a bit. vim.api.nvim_create_autocmd("FileType", { pattern = "qf", callback = function() vim.wo.number = false vim.wo.cursorline = true vim.cmd.resize(20) end, })