Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable preview in :Buffers, :Rg and similar commands #1130

Closed
5 tasks done
bravoecho opened this issue Sep 27, 2020 · 2 comments
Closed
5 tasks done

Cannot disable preview in :Buffers, :Rg and similar commands #1130

bravoecho opened this issue Sep 27, 2020 · 2 comments

Comments

@bravoecho
Copy link

bravoecho commented Sep 27, 2020

The preview is disabled:

  • globally in Vim (let g:fzf_preview_window = "")
  • globally in the shell (FZF_DEFAULT_OPTIONS="... --preview-window=:hidden ...")

It"s not shown in the shell nor in vim when executing :Files, but it"s still shown for all the other fzf Vim commands.

I"ve read a lot of existing issues, and some of them seem to be similar, but none has a resolution that works in my case, even though a couple of them sound related:

Below a verbatim extract of my configuration.

Any help or pointers will be greatly appreciated.

vimrc

let g:fzf_layout = { "down": "~30%" }
let g:fzf_tags_command = "ctags -R"
let g:fzf_preview_window = ""
let g:fzf_buffers_jump = 0
nmap <C-p> :Files<CR>
noremap <Leader>b :Buffers<CR>

shell (zsh)

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPTS="--extended --history=$HOME/.fzf_history --color=light --ansi --reverse --info=inline --bind "ctrl-/:toggle-preview" --preview-window=:hidden --preview="[ -f {} ] && head -n 200 {}""
[ -n "$(command -v fd)" ] && export FZF_DEFAULT_COMMAND="fd --type file --hidden --follow --color=always --exclude .git --no-ignore-vcs"
[ -n "${FZF_DEFAULT_COMMAND}" ] && export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
FZF_COMPLETION_TRIGGER="~~"

This is the output of :command Buffers in Vim:

      Name              Args Address Complete    Definition
 !|  Buffers           ?            buffer      call fzf#vim#buffers(<q-args>, s:p(<bang>0, { "placeholder": "{1}" }), <bang>0)
@junegunn
Copy link
Owner

Fixed in master.
You might want to use a setting like this to get optional preview window you can dynamically enable.

" Preview window on the right side of the window,
" hidden by default, ctrl-/ to toggle
let g:fzf_preview_window = ["right:hidden", "ctrl-/"]

@junegunn
Copy link
Owner

junegunn commented Oct 24, 2020

And I generally do not recommend setting preview options in your FZF_DEFAULT_OPTS. See https://github.com/junegunn/fzf#preview-window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants