Hey there,
I’m moving my Vim configurations to Lua, and I would like to know how to convert the following method:
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
copen
else
cclose
endif
endfunction
Hey there,
I’m moving my Vim configurations to Lua, and I would like to know how to convert the following method:
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
copen
else
cclose
endif
endfunction
A simple conversion would look like this.
function ToggleQuickFix()
if vim.fn.empty(vim.fn.filter(vim.fn.getwininfo(), "v:val.quickfix")) == 1 then
vim.cmd([[copen]])
else
vim.cmd([[cclose]])
end
end
Nice!! Thanks. Worked like a charm.