116

Vim comes with an exhaustive and fully indexed documentation that contains the answers to most of the questions you may have on using Vim. But the documentation is huge and may look to the neophyte as an impenetrable maze. Here are a few guidelines to help you find what you need… The :help command is your gateway to Vim's documentation. Read the first ...


47

Just expand the help window to be the only visible window: Ctrlw-o When you're done you can switch back to your other buffers.


33

This actually took quite some searching, but the correct way is 'Vim'. From :help pronounce: Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a capital, since it's a name, again like Jim. Some parts of the Vim documentation does the all-caps 'VIM' though, this seems to be older documentation. I could not find any references 'ViM' ...


31

Sharpen the saw The best general advice is a simple one, "Sharpen the saw" from Bram's Seven habits essay. I also suggest Vimcasts blog post: On sharpening the saw. Basically "sharpening the saw" can be summarized as: Don't learn everything all at once, but learn a few things at a time. When you find an inefficiency look for ways to improve it. ...


24

Alternatively, you could open the help window in a new tab: :tab help foo, and then use :q to close it.


19

You can learn Vim by reading :help from top to bottom. When you enter :help, it looks like this: *help.txt* For Vim version 7.3. Last change: 2010 Jul 20 VIM - main help file k Move around: Use the cursor keys, or "h" to go left, h l ...


18

You can use :vert h [your topic] to open help vertically. You can use the following command: cnoreabbrev H vert h To make vim replace H by vert h automatically in command line. Also you can use this abbreviation: cnoreabbrev HR vert bo h To open the help window on the right side of the screen. (see :h :botright for more details on bo)


17

The other answers have already answered your question, but for the sake of completeness: If you just want to temporarily get a larger window for your help-viewing, you can use either or both of the Ctrl-w _ and Ctrl-w | mappings to maximise the help window as much as possible vertically or horizontally, respectively, but without closing your existing split ...


15

Setting names are always surrounded by quotes, so use: :help 'display' to get the page you want. You get some useful completions when pressing Ctrl+D, ie: :help display<^D> Will give you: -display :display 'display' :syn-display strdisplaywidth() As completions :-) Bonus tip: If you use :set wildmenu, this will also work with Tab, and you ...


15

Using :helptags ALL should re-generate all helptags for all doc directories in runtimepath; which should include the ~/.vim/pack/default/start/* directories. You will probably get an error similar to: E152: Cannot open /usr/share/vim/vim81/doc/tags for writing Which is safe to ignore. Vim will continue generating helptags after this error (check the ...


13

It's a latin term meaning "the same". In the quoted context, it just means the listed command does the same thing as the previously listed command, i.e. remove item 3: :let i = remove(list, 3) " remove item 3 :unlet list[3] " idem


10

Help for Ex commands is always listed with the colon included: :help :display Help for settings is always listed with surrounding quotes, as Carpetsmoker already described: :help 'display' Specific help files are listed by their file name: :help undo.txt (cf. :help undo) Help for built-in functions is listed with trailing parentheses: :help split() (...


10

That's not a cheat sheet; it's a history of the commands you've executed. It allows you to find, edit and repeat commands you've previously executed. There are a couple of ways you can enter it. One is to type Ctrl-F while on the ex command line. Another way is to type q: while in normal mode. You can read more about it here: :help 20.4 :help 20.5 :help ...


9

Like others have mentioned vimtutor is a good place to start, there are several other resources available to you for improving on your knowledge & understanding of the vim philosophy, which needless to say is not only brilliant but surprisingly & pleasantly intuitive. However I would still like to use an example to draw a parallel to how one should ...


8

Adding a help file is actually fairly easy: as documented in :help add-local-help, you plop it in ~/.vim/doc and then run :helptags ~/.vim/doc. That's (part of) what your plugin manager is doing for you when you install a plugin. You can confirm its been added by running :help local-additions; all the local help files should be listed there. If you need ...


8

Use the -c argument to execute a command after Vim starts up: vim -c ':help TOPIC' -c :only You may want to define a shell function: vimhelp () { vim -c ":help $1" -c :only }


8

As far as I know there is currently no good solution for either problem, but a lot of people would be interested in solving them. Markdown is a superset of HTML, so I'd say a frontal approach to conversion from markdown to Vim help is unlikely to succeed. If you can speak Haskell you could try to write a Vim help backend for pandoc. That would be a very ...


8

This is inspired from junegunn 's vimrc: augroup vimrc_help autocmd! autocmd BufEnter *.txt if &buftype == 'help' | wincmd L | endif augroup END


8

The tag is useful for two things: When using the :help command, the tag is the exact phrase which will let you distinguish between similar terms. {subject} E149 E661 :h[elp] {subject} Like ":help", additionally jump to the tag {subject}. For example, <c-A> is available in insert, normal and ...


8

using the command :clo[se] instead of :q seems to have solved the problem for me. I.e. if I issue :clo with the above window layout, it causes vim to throw E444: Cannot close last window. In fact it seems :close was intended for this situation, i.e. to prevent accidental closing of the editor when all you wanted to do was close a window (or tab) from ...


8

you have to create the help-tags. Run :helptags for the dir where you installed the docs. On unix this would most likely be :helptags ~/.vim/doc. Or simply recreate them all with :helptags ALL


7

You can move the help screen to its own tab with ctrl+w T (note the T is upper case). Then you can switch between the tabs with gt.


7

Asked: Setting the filetype The autocommands in the question are a good start, and with 2 extra pieces of knowledge we can finish it: You can define autocommands everywhere. autocmd and augroup are "just" regular Vim commands, not special syntax or keywords. So defining an autocmd from within an autocmd is perfectly fine. You can define autocommands to be ...


7

In the help files the identifiers are actually marked as |identifier| (but you don't see the | because of the syntax file, use set ft=txt in an help buffer to check what I'm talking about). You could then create a mapping which would look for the next pattern \|\W*\| and you should be good. Something like: execute "nnoremap ]i :call search('\\|\\w*\\|')&...


6

You can make the help window full width and height by eliminating all other split windows, using Control-wo while inside the help window. This command makes the current window the only window, removing all other windows.


6

You can learn the basics by running vimtutor at the command line. This ships with vim and provides a basic interactive tutorial on it's use.


6

1'st method Run vimtutor (from command line) with 2 letter language code like: vimtutor en (for English) vimtutor pt (for Portuguese) etc... 2'nd method Open tutor with different language with: vim /usr/share/vim/vim74/tutor/tutor (for English) vim /usr/share/vim/vim74/tutor/tutor.pt (for Portuguese) etc... (The same default path applies to Cygwin ...


6

You can use a custom command that does the vertical-or-not selection for you. This can be based on the current window width and height : function! s:ShowHelp(tag) abort if winheight('%') < winwidth('%') execute 'vertical help '.a:tag else execute 'help '.a:tag endif endfunction command! -nargs=1 H call s:ShowHelp(<f-args>) ...


6

They are error codes. If you do something wrong and Vim gives you an error code you can search the documentation for its meaning. Some common ones are listed and explained under :help error-messages but most are scattered around the documentation, generally close to the commands that would cause that error. Some errors like this one are pretty cryptic, ...


Only top voted, non community-wiki answers of a minimum length are eligible