Command line manual page is an indispensable tool for working with Linux system.If you forget how to use a command, just type man followed by the name of the command. One thing I don't like about the manual system on my Debian sid is that it uses most to display the manual. The key bindings of most feel awkward for me since I am used to vim. Of course, there are many "vimers" like me, and they've found ways to fix this. Actually, there are many different ways, but I find the approach below works best for me. Basically, it involves creating a shell alias for man, so when man is used, shell invokes vim instead to read the manual. The following is added in ~/.bashrc:

# use vim as man's pager, rely on ManPageView plugin 
vman() {   
  /usr/bin/whatis "$@" > /dev/null   
  if [ $? -eq 0 ]; then     
    /usr/bin/vim -c "Man $@" -c 'silent! only' -c 'nmap q :q'   
  else     
    /usr/bin/man "$@"   
  fi 
} 
alias man='vman'`

This script relies on ManPageView plugin. However, I found the bundled syntax highlighting for this plug-in does not work as I expected, so I just deleted ~/.vim/syntax/man.vim. It works because vim 7.0 has manual page syntax highlighting already built-in.



Comments

comments powered by Disqus