forked from scrooloose/vimfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
key_mappings.vim
114 lines (89 loc) · 2.53 KB
/
key_mappings.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
" Shortcut to rapidly toggle `set list`
nmap <Leader>sic :set list!<CR>
" As esc is to far away I would like to quit imode with jj
inoremap jj <Esc>
" Toggle AutoClose
nmap <Leader>x <Plug>ToggleAutoCloseMappings
" Align selected lines
nmap <Leader>a :Align
vmap <Leader>a :Align
" Some mappings for rails.vim
nmap <Leader>rr :R<CR>
nmap <Leader>ra :A<CR>
" shortcut for closing a buffer
nmap <Leader>d :bd<CR>
"key mappings for saving file
imap <C-s> <ESC>:w<CR>
nmap <C-s> :w<CR>
"Indent the whole file
imap <silent> <F5> <Esc> mmgg=G'm
nmap <silent> <F5> mmgg=G'm
" Open new line below/above current line
inoremap <M-o> <Esc>o
inoremap <M-S-o> <ESC>O
"inoremap <C-j> <Down>
"Show syntastics list of errors
nmap <Leader>e :Errors<CR><C-j>
"Mapping for selecting the latest inserted text
nmap <silent> <Leader>sli `[v`]
" PeepOpen uses <Leader>p as well so you will need to redefine it so something
" else in your ~/.vimrc file, such as:
" nmap <silent> <Leader>q <Plug>PeepOpen
silent! nmap <silent> <Leader>p :NERDTreeToggle<CR>
nnoremap <silent> <C-f> :call FindInNERDTree()<CR>
"make <c-l> clear the highlight as well as redraw
nnoremap <C-L> :nohls<CR><C-L>
inoremap <C-L> <C-O>:nohls<CR>
"map to bufexplorer
""nnoremap <leader>b :BufExplorer<cr>
"map Q to something useful
noremap Q gq
"make Y consistent with C and D
nnoremap Y y$
"key mapping for vimgrep result navigation
map <A-o> :copen<CR>
map <A-q> :cclose<CR>
map <A-j> :cnext<CR>
map <A-k> :cprevious<CR>
"key mapping for window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
" overwrite vim-latex mapping for <C-J> to <Plug>IMAP_JumpForward
map <C-J> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"key mapping for tab navigation
nmap <Tab> gt
nmap <S-Tab> gT
"Key mapping for textmate-like indentation
nmap <D-[> <<
nmap <D-]> >>
vmap <D-[> <gv
vmap <D-]> >gv
"mapping for command key to map navigation thru display lines instead
"of just numbered lines
vmap <D-j> gj
vmap <D-k> gk
vmap <D-4> g$
vmap <D-6> g^
vmap <D-0> g^
nmap <D-j> gj
nmap <D-k> gk
nmap <D-4> g$
nmap <D-6> g^
nmap <D-0> g^
" Remap CommandT keys, as t is already mapped to something
" else and takes ages to open
nmap <silent> <Leader>O :CommandTFlush<CR>
nmap <silent> <Leader>o :CommandT<CR>
" key mappings for FuzzyFinder
nmap <silent> <Leader>fl :FufLine<CR>
nmap <silent> <Leader>fb :FufBuffer<CR>
" mappings for YankRing
nnoremap <silent> <Leader>yrs :YRShow<CR>
" mappings for fugitive
nmap <leader>gs :Gstatus<CR>
nmap <leader>gc :Gcommit<CR>
nmap <leader>gw :Gwrite<CR>
nmap <leader>gr :Gread<CR>
nmap <leader>gd :Gdiff<CR>