Skip to content

Commit

Permalink
feat: provide warning for ’winfixbuf’ (closes #1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed May 24, 2024
1 parent b442569 commit 0c4458b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lua/fzf-lua/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ M.vimcmd_file = function(vimcmd, selected, opts, pcall_vimcmd)
return
end
end
if utils.__HAS_NVIM_010
and vim.wo.winfixbuf
and vimcmd == "e"
and curbuf ~= fullpath
then
utils.warn("'winfixbuf' is set for current window, unable to change buffer.")
return
end
-- add current location to jumplist
if not is_term then vim.cmd("normal! m`") end
-- only change buffer if we need to (issue #122)
Expand Down Expand Up @@ -315,6 +323,14 @@ M.vimcmd_buf = function(vimcmd, selected, opts)
return
end
end
if utils.__HAS_NVIM_010
and vim.wo.winfixbuf
and vimcmd == "b"
and curbuf ~= entry.bufnr
then
utils.warn("'winfixbuf' is set for current window, unable to change buffer.")
return
end
-- add current location to jumplist
if not is_term then vim.cmd("normal! m`") end
if vimcmd ~= "b" or curbuf ~= entry.bufnr then
Expand Down

0 comments on commit 0c4458b

Please sign in to comment.