|
|
| Line 13: |
Line 13: |
| |
===Inserting an empty line=== |
|
===Inserting an empty line=== |
| |
With the following map, you can press Enter in normal mode to insert an empty line. |
|
With the following map, you can press Enter in normal mode to insert an empty line. |
| − |
|
|
| |
<pre> |
|
<pre> |
| − |
:nmap <Enter> _i<Enter><Esc> |
+ |
:nmap <CR> _i<Enter><Esc> |
| |
</pre> |
|
</pre> |
| |
|
|
|
| Line 23: |
Line 22: |
| |
" Enter a blank line below/above cursor in Normal mode. |
|
" Enter a blank line below/above cursor in Normal mode. |
| |
" The o command will continue comments in a program. |
|
" The o command will continue comments in a program. |
| − |
nmap ,o o<Esc>k |
+ |
nmap ,o o<Esc>k |
| − |
nmap ,O O<Esc>j |
+ |
nmap ,O O<Esc>j |
| |
</pre> |
|
</pre> |
| |
|
|
|
| Line 32: |
Line 31: |
| |
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. |
|
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> |
+ |
:nnoremap <Space> i<Space><Esc> |
| |
|
|
|
| |
For example, suppose we want foo to be aligned with bar: |
|
For example, suppose we want foo to be aligned with bar: |
| Line 44: |
Line 43: |
| |
|
|
|
| |
==Comments== |
|
==Comments== |
| − |
|
|
| − |
---- |
|
Latest revision as of 09:02, September 29, 2008
Inserting an empty line
Edit
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
Edit
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'.