History Report a problem
Article Edit this page Discussion

Insert in normal mode

From Vim Tips Wiki

Jump to: navigation, search
 

Tip 604Previous TipNext Tip

Created: November 18, 2003 Complexity: basic Author: Sigurd/Yakov Lerner Minimum version: 5.7 Karma: 14/5 Imported from: Tip#604


[edit] Inserting an empty line

With the following map, you can press Enter in normal mode to insert an empty line.

:nmap <Enter> _i<Enter><Esc>

Here is an alternative:

" Enter a blank line below/above cursor in Normal mode.
" The o command will continue comments in a program.
nmap ,o o<Esc>k
nmap ,O O<Esc>j

[edit] Inserting a space

If you manually align text (declarations, ascii tables, trailing comments), you'll find this simple mapping useful.

In normal mode, it inserts a space to push the rest of the line to the right, while leaving the cursor in the same position.

:nnoremap <Space> i<Space><Esc>

For example, suppose we want foo to be aligned with bar:

int   foo;  // ...
double    bar;  // ...

Move the cursor just after 'int'. Press Space until 'foo' is aligned with 'bar'.

[edit] Comments

 

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Insert in normal mode"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation