Bunch of git changes
2f871df8dfe494c558ae3ec2289717fcb05a5bd1
1 parent
87cb6a3a
.vimrc
+10 -11
| 99 | 99 | let col = col('.') - 1 |
|
| 100 | 100 | return !col || getline('.')[col - 1] =~ '\s' |
|
| 101 | 101 | endfunction |
|
| 102 | 102 | endif |
|
| 103 | 103 | ||
| 104 | - | " Update gutter whenever possible |
|
| 105 | - | au FocusLost * :GitGutter |
|
| 106 | - | ||
| 107 | 104 | " Save on focus lost |
|
| 108 | 105 | au FocusLost * call s:SaveOnFocusLost() |
|
| 109 | 106 | function! s:SaveOnFocusLost() |
|
| 110 | 107 | if !empty(expand('%:p')) && &modified |
|
| 111 | 108 | write |
| 177 | 174 | " Like '*' but stays on the original word |
|
| 178 | 175 | nnoremap <C-n> *N |
|
| 179 | 176 | nnoremap c* *Ncgn |
|
| 180 | 177 | nnoremap <Leader>h :nohl<CR> |
|
| 181 | 178 | ||
| 182 | - | " Git |
|
| 183 | - | nnoremap <Leader>gc :Gcommit -v<CR> |
|
| 184 | - | nnoremap <Leader>gc. :Gwrite <Bar> Gcommit -v<CR> |
|
| 185 | - | nnoremap <Leader>gca :Git commit -a<CR> |
|
| 186 | - | nnoremap <Leader>ga :GitGutterStageHunk<CR> |
|
| 187 | - | nnoremap <Leader>ga. :Gwrite<CR> |
|
| 188 | - | nnoremap <Leader>gu :GitGutterUndoHunk<CR> |
|
| 189 | - | nnoremap <Leader>gp :GitGutterPreviewHunk<CR> |
|
| 190 | 179 | nnoremap <Leader>n :cnext<CR> |
|
| 191 | 180 | nnoremap <Leader>p :cprev<CR> |
|
| 192 | 181 | ||
| 182 | + | " Git |
|
| 183 | + | nnoremap <Leader>gg :GitGutterToggle<CR> |
|
| 184 | + | nnoremap <Backspace> :GitGutterUndoHunk<CR> |
|
| 185 | + | nnoremap <Return> :GitGutterStageHunk<CR> |
|
| 186 | + | ||
| 187 | + | cnoreabbrev gw Gwrite |
|
| 188 | + | cnoreabbrev gc Gcommit -v |
|
| 189 | + | cnoreabbrev gn GitGutterNextHunk |
|
| 190 | + | cnoreabbrev gp GitGutterPrevHunk |
|
| 191 | + | ||
| 193 | 192 | " Select recently pasted text |
|
| 194 | 193 | nnoremap <leader>p V`] |
|
| 195 | 194 | ||
| 196 | 195 | " Switch buffers easily |
|
| 197 | 196 | nnoremap <Tab> <C-^> |