pawelduda / fzf-live-repl

Turn your fzf into a live REPL
The Unlicense
253 stars 7 forks source link

man page completion #1

Open jay-aye-see-kay opened 5 years ago

jay-aye-see-kay commented 5 years ago

I saw you had this as a todo and managed to make it work, so I thought I'd share (there's probably a cleaner way of doing this, I just mashed your code and an example from the fzf wiki until it worked).

man -k . | fzf --preview "echo {} | awk '{print $1}' | xargs -r man" | awk '{print $1}' | xargs -r man

I've used {} instead of {q} in the preview to show what's under the cursor rather that what's typed. This is more useful to me personally.

I came across your post on HN this morning, had never seen fzf's preview option before - thanks for posting it

pawelduda commented 5 years ago

Hey man. I just checked it out and this is AWESOME! I encourage you to make a pull request. Otherwise, I can add it myself. I see some room for taking it even further but I am not sure whether it is technically possible - will need more time for that.

Anyway, this is good enough to be in this project.

rothgar commented 5 years ago

I have a similar mans function but I'm not sure what I have does the same thing.

I'm not at a computer right now to test but here's mine for comparison.

https://github.com/rothgar/dotfiles/blob/master/zdotdir/.zshrc#L330

FWIW I found this in someone else's dotfiles but I don't remember where

pawelduda commented 5 years ago

@rothgar thank you, I will check it out later and get back to you as soon as I can