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

long-line wrap on preview window #756

Closed
acornejo opened this issue Dec 3, 2016 · 7 comments
Closed

long-line wrap on preview window #756

acornejo opened this issue Dec 3, 2016 · 7 comments
Assignees
Labels

Comments

@acornejo
Copy link
Contributor

acornejo commented Dec 3, 2016

fzf performs line wrap on long lines on its preview window. Sometimes this is not desirable, while I can try to fix this using cut and other bash utilities, it makes all the scripts unnecessarily complicated.

It would be great if fzf supported an option to truncate long lines on the preview window.

@junegunn
Copy link
Owner

junegunn commented Dec 3, 2016

to fix this using cut and other bash utilities

Usually I would suggest the approach but I can understand the pain in this case. It's not easy to know the exact width of the preview window from the script. I think we can consider extending --preview-window to take :nowrap (or :truncate) suffix. --preview-window right:60%:nowrap.

@acornejo
Copy link
Contributor Author

acornejo commented Dec 3, 2016

Thanks. nowrap option sounds good. I would actually even consider doing the opposite, i.e. make nowrap the default and add a wrap behavior. I am willing to bet most people that use fzf are looking at source code, and for source code preview line wrapping is almost always NOT what you want.

Do you want a PR for this feature, or do you already have an idea of how to implement this.

@junegunn
Copy link
Owner

junegunn commented Dec 4, 2016

I'll look into it when I get some time. Thanks. I'll also think about changing the default.

@junegunn junegunn self-assigned this Dec 4, 2016
@junegunn
Copy link
Owner

junegunn commented Dec 4, 2016

Pushed to master. Now, one has to add [:]wrap to --preview-window to make fzf wrap long lines in the preview window (e.g. --preview-window down:wrap, --preview-window wrap, etc). Let me know if you see any issues with the change.

Hmm, I need to fix linux build.

junegunn added a commit that referenced this issue Dec 4, 2016
@IngoMeyer441
Copy link

IngoMeyer441 commented Jan 20, 2017

I'm using the current version of fzf and on Linux lines are still wrapped in the preview window. Is that a known issue?

@acornejo
Copy link
Contributor Author

acornejo commented Jan 20, 2017

defintely not a known issue: preview wrap works well and is even enabled by default.

I just confirmed it by running the following:

# fzf --version
0.16.1
# echo hi | fzf --preview="yes hello | head -n500 | tr '\n' ' '"

Please try running fzf --version to confirm you are indeed running the latest. Also try the example I pasted and see if you see a single line in the preview window or multiple lines.

If your problem indeed persist, I would suggest checking the COLUMNS and LINES environment variable, as well as reporting the terminal emulator that you are using.

@IngoMeyer441
Copy link

Sorry, my fault, I was running fzf 0.15.9. On my system, fzf is updated by my vim plugin manager and since I made some changes to shell/key-bindings.zsh the plugin manager was not able to pull the latest release. On 0.16.1 nowrap works without any problems, thanks!

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

No branches or pull requests

3 participants