all repos

init.lua @ 4273b75

my nvim config
3 files changed, 36 insertions(+), 4 deletions(-)
feat: add some quickfix stuff
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed at: 2023-10-31 17:25:00 +0200
Parent: 714a551
M lua/core/keymaps.lua

@@ -9,8 +9,9 @@ map("n", "<C-d>", "<C-d>zz")

map("n", "<C-u>", "<C-u>zz") -- quickfix -map("n", "<leader>n", "<cmd>cnext<cr>") -map("n", "<leader>N", "<cmd>cprev<cr>") +map("n", "<localleader>j", "<cmd>cnext<cr>") +map("n", "<localleader>k", "<cmd>cprev<cr>") +map("n", "<localleader>;", u.qf_toggle) --- buffers map("n", "<leader>q", "<cmd>quit!<cr>")
M lua/core/utils.lua

@@ -1,3 +1,4 @@

+local is_qf_exists = false return { ---@param mode string|table ---@param from string

@@ -25,5 +26,26 @@ module,

method, args ) + end, + + qf_toggle = function() + is_qf_exists = false + for _, win in pairs(vim.fn.getwininfo()) do + if win["quickfix"] == 1 then + is_qf_exists = true + end + end + if is_qf_exists == true then + vim.cmd "cclose" + return + end + if not vim.tbl_isempty(vim.fn.getqflist()) then + vim.cmd "copen" + end + end, + + ---@return boolean + get_qf_status = function() + return is_qf_exists end, }
M lua/plugins/lualine.lua

@@ -1,3 +1,4 @@

+local u = require("core.utils") local c = { mode = { function()

@@ -25,11 +26,19 @@ return "[" .. client_names_str .. "]"

end end, }, + qf_status = { + function() + if u.get_qf_status() then + return "●" + end + return "" + end, + }, } return { "nvim-lualine/lualine.nvim", - event = "VeryLazy"; + event = "VeryLazy", opts = { options = { theme = "tokyonight",

@@ -47,7 +56,7 @@ sections = {

lualine_a = { c.mode }, lualine_b = {}, lualine_c = { "filename", "branch", c.diagnostic }, - lualine_x = { c.lsp, "diff" }, + lualine_x = { c.qf_status, c.lsp, "diff" }, lualine_y = {}, lualine_z = { c.location }, },