Tip #327: key mappings
tip karma |
Rating 2/11, Viewed by 1620
|
created: |
|
September 13, 2002 17:57 |
|
complexity: |
|
basic |
author: |
|
Nithin |
|
as of Vim: |
|
6.0 |
I use my left thumb for the alt key and right for the space. Using this combo, you can get
some useful key maps for which you don't have to move your hands. I find I have to turn
my hand a little to press the left ctrl key.
These are some maps i use for C programming.
map ' `
map <C-f> :w<C-m>:!make<C-m>
map <M-]> <C-]> Tags
map <M-[> <C-t> Tags
map <M-u> :!ctags -R *<C-m> Build Tags
map <M-c> I/*<Esc>A*/<Esc> Comment current line
map <M-d> ^xx$xx Delete comment for a single line
map <M-l> [{zf% Fold upto the enclosing brace level
map <M-o> zo open fold
map <M-i> zc close fold
map <M-.> :cn<C-m> Go to next error in list
map <M-,> :cp<C-m> previous error in list
imap <Tab> <C-p> Complete word
inoremap <S-Tab> <Tab> Tab
inoremap { <CR>{<CR> Brace and line
inoremap } <CR>} brace and line. saves one enter stroke
imap <M-j> <Esc> Escape. Don't want to move my hand to esc key.
imap <M-k> <C-y> Copy line from above.
imap <M-q> /* */<Esc>hhi Comment selected lines
noremap <M-r> ddko{<C-m>}<Esc>kpko Convert a simple statement to a compound statement. And place cursor above prev line.
noremap <M-k> ddko{<C-m>}<Esc>kpo Same as above but place cursor below old line.
vnoremap <M-j> <Esc>
vnoremap <M-c> di/*<C-m>/<C-m><Esc>kkp Commented selected text
nmap <M-n> :noh<CR> No hilight
Bye,
Nithin.
<<Help for VIM Help (VIM QuickRef) |
Vim in Microsoft Visual Foxpro >>
Additional Notes
|