forked from astrails/dotvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bindings.vim
71 lines (54 loc) · 1.51 KB
/
bindings.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
" Don't use Ex mode, use Q for formatting
map Q gq
"make Y consistent with C and D
nnoremap Y y$
" toggle highlight trailing whitespace
nmap <silent> <leader>s :set nolist!<CR>
" Ctrl-N to disable search match highlight
nmap <silent> <C-N> :silent noh<CR>
" Ctrol-E to switch between 2 last buffers
nmap <C-E> :b#<CR>
" ,e to fast finding files. just type beginning of a name and hit TAB
nmap <leader>e :e **/
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" ,n to get the next location (compilation errors, grep etc)
nmap <leader>n :cn<CR>
nmap <leader>N :cp<CR>
" ,d to diffupdate
nmap <leader>d :diffupdate<CR>
nmap <leader>dp :diffput<CR>
nmap <leader>dg :diffget<CR>
" driving me insane this thing
command Q q
command Qa qa
command QA qa
command -nargs=* -complete=file W w <args>
command -nargs=* -complete=file E e <args>
" center display after searching
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#z
""""""""""" awesome stuff from vimbits.com
" keep selection after in/outdent
vnoremap < <gv
vnoremap > >gv
" better navigation of wrapped lines
nnoremap j gj
nnoremap k gk
" easier increment/decrement
nnoremap + <C-a>
nnoremap - <C-x>
" remove trailing spaces
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<cr>
" easy split navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" fast expand current file's directory in command mode
cnoremap %% <C-R>=expand('%:h').'/'<cr>