jez / vim-superman

Read Unix man pages faster than a speeding bullet!
http://blog.jez.io/2014/12/20/vim-as-a-man-page-viewer/
MIT License
190 stars 20 forks source link

Improved vman() shell function #13

Closed casey closed 7 years ago

casey commented 7 years ago

This version of vman() checks to see if the requested man page exists before trying to launch superman.

This makes trying to look up a man page that doesn't exist faster and less visually jarring.

This PR assumes that man takes a superset of the arguments to -c Superman, which I'm not sure is the case. It appears to work with both 'vman 3 printfandvman printf`, although perhaps there are other forms which I don't know about.

PS Thanks for superman, it's rad!

casey commented 7 years ago

Whoops, left off the early return. Added.

casey commented 7 years ago

The &> is very slightly less well supported. Zsh and bash support it, but dash, tcsh, and probably others don't. Given that it's something that users will copy and paste, instead of having to type it in themselves, how do you feel about using the longer (and admittedly uglier) form in case anyone is using a shell that doesn't support the short form?

jez commented 7 years ago

Hmm, that's a good point. I had also forgotten that this was something they add to their shell of choice, and not a script we provide them.

As a side note, maybe in the future we should distribute a standalone script. This way, updating our plugin would automatically update the script. Users could then add something like this to their config file:

export PATH="$PATH:$HOME/.vim/bundle/vim-superman/bin

In this scenario, we could set the script shebang to use bash always, and we wouldn't have to worry about compatibility with non-standard shells.

jez commented 7 years ago

Thanks!