62 |
61 |
63 call vundle#end() |
62 call vundle#end() |
64 " }}} |
63 " }}} |
65 |
64 |
66 " Key maps {{{ |
65 " Key maps {{{ |
67 nmap <silent> <F1> :Unite buffer<CR> |
66 nnoremap <silent> <F1> :Unite buffer<CR> |
68 nmap <silent> <F2> :VimFilerExplorer<CR> |
67 nnoremap <silent> <F2> :VimFilerExplorer<CR> |
69 map <silent> <F4> :noh<CR> |
68 noremap <silent> <F4> :noh<CR> |
70 nmap <silent> <F5> :GundoToggle<CR> |
69 nnoremap <silent> <F5> :GundoToggle<CR> |
71 nmap <silent> <F8> :TagbarToggle<CR> |
70 nnoremap <silent> <F8> :TagbarToggle<CR> |
72 |
71 |
73 nmap <leader>uw :Unite -quick-match -short-source-names window tab:no-current<CR> |
72 nnoremap <leader>uw :Unite -quick-match -short-source-names window tab:no-current<CR> |
74 nmap <leader>us :Unite -quick-match session<CR> |
73 nnoremap <leader>us :Unite -quick-match session<CR> |
75 nmap <leader>uf :Unite -start-insert file_rec/async:!<CR> |
74 nnoremap <leader>uf :Unite -start-insert file_rec/async:!<CR> |
76 |
75 |
77 " stop opening help by mistake |
76 " stop opening help by mistake |
78 imap <F1> <ESC> |
77 inoremap <F1> <ESC> |
79 |
78 |
80 " let F4, :noh work as-is in insert mode |
79 " let F4, :noh work as-is in insert mode |
81 imap <F4> <C-O><F4> |
80 imap <F4> <C-O><F4> |
82 |
81 |
83 " chdir to the directory of the open buffer |
82 " chdir to the directory of the open buffer |
84 map <leader>cd :cd %:p:h<cr>:pwd<cr> |
83 noremap <leader>cd :cd %:p:h<cr>:pwd<cr> |
85 |
84 |
86 map <leader>pp :setlocal paste!<cr> |
85 noremap <leader>pp :setlocal paste!<cr> |
87 |
86 |
88 " faster window nav |
87 " faster window nav |
89 nmap <C-h> <C-w>h |
88 nnoremap <C-h> <C-w>h |
90 nmap <C-j> <C-w>j |
89 nnoremap <C-j> <C-w>j |
91 nmap <C-k> <C-w>k |
90 nnoremap <C-k> <C-w>k |
92 nmap <C-l> <C-w>l |
91 nnoremap <C-l> <C-w>l |
93 nmap <C-\> <C-w>p |
92 nnoremap <C-\> <C-w>p |
94 |
93 |
95 " navigate by on-screen lines |
94 " navigate by on-screen lines |
96 nnoremap <expr> j v:count ? 'j' : 'gj' |
95 nnoremap <expr> j v:count ? 'j' : 'gj' |
97 nnoremap <expr> k v:count ? 'k' : 'gk' |
96 nnoremap <expr> k v:count ? 'k' : 'gk' |
98 |
97 |
99 " alt buffer |
98 " alt buffer |
100 nmap gb <C-^> |
99 nnoremap gb <C-^> |
101 nmap gB :ls<CR>:b<Space> |
100 nnoremap gB :ls<CR>:b<Space> |
102 |
101 |
103 " Select last paste, in the same mode it was pasted in |
102 " Select last paste, in the same mode it was pasted in |
104 nmap <expr> gV '`[' . strpart(getregtype(), 0, 1) . '`]' |
103 nnoremap <expr> gV '`[' . strpart(getregtype(), 0, 1) . '`]' |
105 |
104 |
106 " Use ltag over tselect |
105 " Use ltag over tselect |
107 nmap g<C-]> :call vimrc#Ltag(expand('<cword>'))<CR> |
106 nnoremap g<C-]> :call vimrc#Ltag(expand('<cword>'))<CR> |
108 |
107 |
109 " clear all interestingwords with \\k since \K is ri.vim |
108 " clear all interestingwords with \\k since \K is ri.vim |
110 nmap <silent> <leader><leader>k :call UncolorAllWords()<CR> |
109 nnoremap <silent> <leader><leader>k :call UncolorAllWords()<CR> |
111 |
110 |
112 " use Ag for a recursive * |
111 " use Ag for a recursive * |
113 nmap g* :call ag#Ag('grep', '--literal ' . shellescape(expand("<cword>")))<CR> |
112 nnoremap g* :call ag#Ag('grep', '--literal ' . shellescape(expand("<cword>")))<CR> |
114 |
113 |
115 " K: doc, gK: Doc w/o using syntax hints, gKK: doc current filename |
114 " K: doc, gK: Doc w/o using syntax hints, gKK: doc current filename |
116 nmap K :call ViewDoc('doc', expand('<cword>'))<CR> |
115 nnoremap K :call ViewDoc('doc', expand('<cword>'))<CR> |
117 nmap gKK :call ViewDoc('doc', expand('%'))<CR> |
116 nnoremap gKK :call ViewDoc('doc', expand('%'))<CR> |
118 |
117 |
119 " Tabular shortcuts |
118 " Tabular shortcuts |
120 map <leader>ta :Tabularize first_arrow<CR> |
119 noremap <leader>ta :Tabularize first_arrow<CR> |
121 map <leader>te :Tabularize first_eq<CR> |
120 noremap <leader>te :Tabularize first_eq<CR> |
122 map <leader>tc :Tabularize first_colon<CR> |
121 noremap <leader>tc :Tabularize first_colon<CR> |
123 map <leader>tm :Tabularize methods<CR> |
122 noremap <leader>tm :Tabularize methods<CR> |
124 |
123 |
125 map <silent> <leader>a :call vimrc#AutoFmtToggle()<CR> |
124 noremap <silent> <leader>a :call vimrc#AutoFmtToggle()<CR> |
126 |
125 |
127 if exists("g:loaded_mucomplete") |
126 if exists("g:loaded_mucomplete") |
128 inoremap <expr> <c-e> mucomplete#popup_exit("\<c-e>") |
127 inoremap <expr> <c-e> mucomplete#popup_exit("\<c-e>") |
129 inoremap <expr> <c-y> mucomplete#popup_exit("\<c-y>") |
128 inoremap <expr> <c-y> mucomplete#popup_exit("\<c-y>") |
130 inoremap <expr> <cr> mucomplete#popup_exit("\<cr>") |
129 inoremap <expr> <cr> mucomplete#popup_exit("\<cr>") |