Vim Tips Wiki
Register
Advertisement
Tip 1582 Printable Monobook Previous Next

created February 16, 2008 · complexity basic · author Metacosm · version 7.0


The #vim community started this FAQ to help solve some common problems enountered by new users of Vim.

Using help

Search highlights

Backspace behavior – how to backspace over line-endings and more

Do something to all lines matching a pattern

Format options

End-of-line problems (extra ^Ms all over the place)

Indenting

Not indenting when pasting

Making invisible characters visible (tabs, newlines, trailing spaces,...)

Show matching braces

Answered questions

Unanswered questions

  • How can I remap the escape key to toggle insert mode? By default, INSERT starts insert mode, and ESCAPE takes you back into normal mode. How can I map ESCAPE to do both, toggling insert mode? -- Anonymous 21:37, 6 August 2009 (UTC)
  • How can I make keywords autocompletable when creating a new C source file?
Make sure Vim knows it is a C file: e.g., open it with :e main.c, not just :enew. — Tonymec 16:17, 4 August 2009 (UTC)
  • How can I redirect stderr output in Windows ? I have a problem setting 'makeprg' with a compiler whose error messages can't be caught with '>'.
I believe this question is now obsolete. The default value of 'shellpipe' on Windows seems to be ">%s 2>&1" which will (with the "2>&1") redirect stderr output from :make. The help does not reflect this default value, however. It looks like the support was added back in 6.1.105 but never made it into :help 'shellpipe'. --Fritzophrenic 16:07, 23 March 2009 (UTC)
:help 'shellpipe' talks of "Amiga and MS-Dos" OT1H, of *sh shells OTOH, but doesn't mention W32 (as distinct from MS-Dos). Maybe it should. — Tonymec 16:17, 4 August 2009 (UTC)
  • For encrypted files, :help encryption states: "Text you copy or delete goes to the numbered registers. The registers can be saved in the .viminfo file, where they could be read. Change your 'viminfo' option to be safe." Wouldn't it be a lot better if Vim by default would not write all your sensitive information to the viminfo file?
The registers are a useful place to keep permanent (or semi-volatile) information which will be saved in the viminfo file at closedown and restored at the next startup. I think the 'viminfo' default is sensible; it's only when editing encrypted files that registers can be viewed as containing "sensitive information". If all your files are encrypted (which I don't think should be the Vim default) you can change the 'viminfo' option in the vimrc. Or you can define a user-command, let's say :XX, which will both prompt the user for an encryption key and change the 'viminfo' option — maybe even set it to the empty string. — Tonymec 16:17, 4 August 2009 (UTC)

Other sources

Comments

Advertisement