mirror of
https://github.com/jbranchaud/til
synced 2026-01-16 13:38:02 +00:00
Add Viewing Man Pages with man.vim as a vim til.
This commit is contained in:
@@ -106,6 +106,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
- [Tabs To Spaces](vim/tabs-to-spaces.md)
|
- [Tabs To Spaces](vim/tabs-to-spaces.md)
|
||||||
- [The Vim Info File](vim/the-vim-info-file.md)
|
- [The Vim Info File](vim/the-vim-info-file.md)
|
||||||
- [View Commit History of a File](vim/view-commit-history-of-a-file.md)
|
- [View Commit History of a File](vim/view-commit-history-of-a-file.md)
|
||||||
|
- [Viewing Man Pages with man.vim](vim/viewing-man-pages-with-man-vim.md)
|
||||||
- [Whole Line Auto-Completion](vim/whole-line-auto-completion.md)
|
- [Whole Line Auto-Completion](vim/whole-line-auto-completion.md)
|
||||||
- [Wrap With Some Room](vim/wrap-with-some-room.md)
|
- [Wrap With Some Room](vim/wrap-with-some-room.md)
|
||||||
|
|
||||||
|
|||||||
24
vim/viewing-man-pages-with-man-vim.md
Normal file
24
vim/viewing-man-pages-with-man-vim.md
Normal 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.
|
||||||
Reference in New Issue
Block a user