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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document FZF_PREVIEW_FILE_CMD and FZF_PREVIEW_FILE_CMD #125

Open
thernstig opened this issue Oct 19, 2019 · 5 comments
Open

Document FZF_PREVIEW_FILE_CMD and FZF_PREVIEW_FILE_CMD #125

thernstig opened this issue Oct 19, 2019 · 5 comments

Comments

@thernstig
Copy link

thernstig commented Oct 19, 2019

I could not find any documentation in regards to FZF_PREVIEW_FILE_CMD and FZF_PREVIEW_DIR_CMD.

My initial thought it would be the commands used automatically if I do fzf --preview. But seeing as this repo's main headline is "Ef-馃悷-ient fish keybindings for fzf" I am guessing the two env vars do something else.

Please enlighten us :)

@jethrokuan
Copy link
Owner

The two variables you listed above are the same, so I'm going to answer wrt to just FZF_PREVIEW_FILE_CMD.

This repo provides a widget to preview the file that you're completing for, see https://github.com/jethrokuan/fzf/wiki/FZF-Tab-Completions.

the FZF_PREVIEW_FILE_CMD variable contains the variable to preview the given file. E.g. if it's head -n 10 then the first 10 lines of the file is shown in the preview pane.

@thernstig
Copy link
Author

thernstig commented Oct 27, 2019

@jethrokuan I updated the original question as I got one of the vars wrong.

The page you link to is about if you have tab completions enabled. Are you saying that the command that FZF_PREVIEW_FILE_CMD points to is only used in relation to when FZF_COMPLETE is used? Or is it that FZF_PREVIEW_FILE_CMD is used anytime you use --preview with fzf?

FZF_COMPLETE is not documented on the first page (the readme), but FZF_COMPLETE_OPTS is.

I would also add that FZF_ENABLE_OPEN_PREVIEW is something I did not understand from the comment for that command. Does the comment mean that --preview gets auto-added to all invocations of fzf?

@jethrokuan
Copy link
Owner

jethrokuan commented Oct 29, 2019

The page you link to is about if you tab completions enabled. Are you saying that the command that FZF_PREVIEW_FILE_CMD points to is only used in relation to when FZF_COMPLETE is used? Or is it FZF_PREVIEW_FILE_CMD is anytime you use --preview with fzf?

Yes, only when FZF_COMPLETE is used.

FZF_COMPLETE is not document on the first page (the readme), but FZF_COMPLETE_OPTS is, just a note.

A link to the wiki page is on the readme, but perhaps I should've made it more obvious. I'd consider it secondary to everything else on the readme.

I would also add that FZF_ENABLE_OPEN_PREVIEW is something I did not understand from the comment for that command. Does the comment mean that --preview gets autoadded to all invocations of fzf?

--preview gets added, only for the open command (__fzf_open).

@thernstig
Copy link
Author

This would be a breaking change, but my recommendation to make this more understandable for a user would be to:

  1. Add FZF_COMPLETE to the Variables table (for easy overview of all commands).
  2. Rename FZF_PREVIEW_FILE_CMD to FZF_COMPLETE_PREVIEW_FILE_CMD (breaking change)
  3. Rename FZF_PREVIEW_DIR_CMD to FZF_COMPLETE_PREVIEW_DIR_CMD (breaking change)
  4. Possibly make it so that FZF_ENABLE_OPEN_PREVIEW also adds --preview to "find a file" and "cd into" commands.

Of course, you can reject, none, or some of the ideas. But if you like any of them, I could write separate issues to close this thread. Or keep it open if you prefer of course :)

@c02y
Copy link

c02y commented Apr 23, 2021

Hi, it seems FZF_PREVIEW_FILE_CMD and FZF_PREVIEW_DIR_CMD are only working for fzf-tab, not for the bindings in repo's home page, but I got --preview for fzf in FZF_DEFAULT_OPTS which will work for C-o, but it is not working for dir preview in the bindings, and it is trying to work for C-r but failed for history which preview should be avoid for C-r.

PR #175
PR2 #173

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

3 participants