Tip 604 Printable Monobook Previous Next
created November 18, 2003 · complexity basic · author Sigurd/Yakov Lerner · version 5.7
Inserting an empty line[]
With the following map, you can press Enter in normal mode to insert an empty line.
:nmap <CR> _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
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'.