Skip to content

Commit

Permalink
Use custom statusline for quickfix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
phelipetls committed May 5, 2024
1 parent 2abd450 commit c3882d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .config/nvim/after/ftplugin/qf.lua
@@ -0,0 +1,2 @@
vim.g.qf_disable_statusline = 1
vim.wo.statusline = " %q%{exists('w:quickfix_title')? ' '.w:quickfix_title : ''}%= [%l/%L] "
2 changes: 2 additions & 0 deletions .config/nvim/init.lua
Expand Up @@ -202,6 +202,8 @@ local statusline_autocmds = vim.api.nvim_create_augroup("Statusline", {
clear = true,
})

vim.o.statusline = "%!v:lua.require('helpers.statusline').get()"

vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, {
group = statusline_autocmds,
pattern = "*",
Expand Down
4 changes: 4 additions & 0 deletions .config/nvim/lua/helpers/statusline.lua
Expand Up @@ -26,6 +26,10 @@ local grouped = function(s)
end

M.get = function(opts)
if vim.bo.filetype == "qf" then
return vim.wo.statusline
end

local statusline = {}

table.insert(statusline, grouped(" %f"))
Expand Down

0 comments on commit c3882d9

Please sign in to comment.