Possible Duplicate:
What is in your .vimrc?
I am fairly confident with vim having used it on and off for the pa开发者_运维问答st 3 years but I keep finding new simple suggestions for my vimrc for general editing which, after I use them seem blatantly obvious.
An example being:
noremap p "+p
noremap y "+y
For OS clipboard use (on my linux box anyway)
Another example being:
imap jj <ESC>
So in an attempt to collect together a definitive set of simple vimrc entries I will ask the questions, which do you find most useful?
Edit:
I am looking for the most basic vim commands, not functions and stringed commands
This will save you a lot of pinky strain over the years
nnoremap ; :
This remaps ;
to :
, as it is a relatively unused key and you don't have to press shift for the :
. The :
still works, just in case you still press shift from muscle memory.
Personally, I've also found these to be helpful:
1) Use first person shooter (FPS) games' movement keys for window movements (not a good idea if you use A
or D
often. I don't.)
map <W> <C-w><Up>
map <S> <C-w><Down>
map <A> <C-w><Left>
map <D> <C-w><Right>
2) Use <space>
as a leader
nnoremap <space> <Nop>
let mapleader = " "
3) Disable middle mouse, especially on a mac, where inadvertently using the mouse (to switch applications) pastes content if middle click is accidentally pressed
map <MiddleMouse> <Nop>
imap <MiddleMouse> <Nop>
4) Movement between tabs (kind of similar to Firefox)
map <T> :tabnew<Space>
map <Q> :tabclose<cr>
map <Leader>[ gT
map <Leader>] gt
I forgot to add that for the above, I use it as T <filename><enter>
, which is a nice and quick way of opening a file in the current directory in a new tab.
精彩评论