tabs fixed, added descriptive error message for bad fzf flags

main
bhagwan 3 years ago
parent 4e196386e9
commit 940415f836

@ -42,6 +42,7 @@ M.fzf = function(opts, contents)
fzf_win:create()
local selected = fzf.raw_fzf(contents, M.build_fzf_cli(opts),
{ fzf_binary = opts.fzf_bin })
fzf_win:check_exit_status()
if fzf_win:autoclose() == nil or fzf_win:autoclose() then
fzf_win:close()
end

@ -289,6 +289,7 @@ M.tabs = function(opts)
return res
end
local filtered, excluded = filter_buffers(opts, opts._list_bufs())
if not next(filtered) then return end
@ -298,7 +299,6 @@ M.tabs = function(opts)
bufnrs[b] = nil
end
end
coroutine.wrap(function ()
local items = {}
@ -324,7 +324,7 @@ M.tabs = function(opts)
opts.fzf_opts["--no-multi"] = ''
opts.fzf_opts["--preview-window"] = 'hidden:right:0'
opts.fzf_opts["--delimiter"] = vim.fn.shellescape('[\\)]')
opts.fzf_opts["---with-nth"] = '2'
opts.fzf_opts["--with-nth"] = '2'
local selected = core.fzf(opts, items)

@ -170,6 +170,14 @@ function FzfWin:reset_win_highlights(win, is_border)
vim.api.nvim_win_set_option(win, 'winhighlight', hl)
end
function FzfWin:check_exit_status()
if not self:validate() then return end
local lines = vim.api.nvim_buf_get_lines(self.fzf_bufnr, 0, 1, false)
if lines and #lines[1]>0 then
utils.warn("fzf error: " .. lines[1])
end
end
function FzfWin:_set_autoclose(autoclose)
if autoclose ~= nil then
self._autoclose = autoclose

Loading…
Cancel
Save