1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-08 09:38:04 +00:00

Add Viewing Man Pages with man.vim as a vim til.

This commit is contained in:
jbranchaud
2015-05-17 08:04:09 -05:00
parent 517024a223
commit f58b5b250a
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# Viewing Man Pages with man.vim
In [Quick Man Pages](vim/quick-man-pages.md), I introduced `K` which shells
out to the man page for the unix command under the cursor. It gets better
though. Vim has a built-in plugin, `man.vim`, that you can enable which
allows you to view man pages without shelling out.
Add the following to your `.vimrc` file
```vimscript
runtime! ftplugin/man.vim
" grep
```
Then save it and re-source the configuration with `:source %`.
With the `man.vim` plugin enabled, you can now move your cursor over the
word `grep` and hit `<leader>K` which will pop open the man page for `grep`
in a unnamed, split buffer.
Not only does this prevent context-switching when viewing a man page, but it
also gives you the full power of vim over the content of the man page. You
can search, you can yank text, or you can even pop open the man page for
another command.