--- /dev/null
+# $Id$
+#
+# Use vim for manpages and infopages.
+# Requires vim 5+ and info.vim plugin.
+#
+
+vimmajor=$(vim --help 2>&1 | head -n 1 | sed 's/^VIM[^0-9]*\([0-9]*\)\..*/\1/')
+
+function vman() {
+ vim -c "runtime ftplugin/man.vim" -c "Man ${1-man}" \
+ -c "set nolist noruler ls=0" +"wincmd o"
+}
+
+function vinfo() {
+ vim -c "Info ${1-info}" \
+ -c "set nolist noruler ls=0" +"wincmd o"
+}
+
+if [ ! -z "$vimmajor" -a $vimmajor -gt 4 ]; then
+ alias man=vman
+ alias info=vinfo
+fi
+
+unset vimmajor