简体   繁体   中英

Vim - :helptags in .vimrc?

Some time ago, I have a problem with helptags. I posted question on stackoverflow and got answer.

(more info here: Vim - helptags not working for NERDtree )

However typing each time I run Vim

:helptags ~/.vim/doc

is getting tiring.

Is it possible to put above line to .vimrc, so I didnt need to type this every time?

And my second question is: Why I need to type that command over and over again. Why is it happens?

You can add a shortcut for big commands something like this

nmap jj :helptags ~/.vim/doc<CR>

From now on if you just type jj , helptags will be run in normal mode.

But in this specific case you dont need to do anything!

You don't need to type it everytime! Its just a single time process to generate tags so that when you want some help next time, you can simply type :help NERDTree from within vim and vim will correctly navigate to the exact point in NERD_tree.txt

When you download new plugins for vim, they contain their own help files. By saving those help files in the doc directory and by running

:helptags C:\Program Files (x86)\Vim\vimfiles\doc " on Windows gVim
:helptags ~/.vim/doc                           " in normal vim

we are telling vim "Look! He's a new guy! Add him too, to your help list. I might refer him in future"

the only thing I'd add to this is that using:

nmap jj :helptags ~/.vim/doc<CR>

as a mapping for helptags ties up jj which is a really useful mapping for <ESC>

inoremap jj <ESC>

which by doing that you don't have to leave the home row to hit <ESC> to leave insert mode.

There won't be many times if any at all where you'll actually type jj & if you want to type it, just leave a fraction of a second before typing the second j

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM