Add git Blame to vim; add git blame --color-by-age scheme
dblume

dblume commited on 2023-02-09 23:17:29
Showing 2 changed files, with 20 additions and 12 deletions.

... ...
@@ -7,6 +7,10 @@
7 7
 	submodule = log
8 8
 [difftool]
9 9
 	prompt = false
10
+[color "blame"]
11
+	highlightRecent = 239, 18 month ago, 240, 17 month ago, 241, 16 month ago, 242, 15 month ago, 243, 14 month ago, 244, 13 month ago, 245, 12 month ago, 246, 11 month ago, 247, 10 month ago, 248, 9 month ago, 249, 8 month ago, 250, 7 month ago, 251, 6 month ago, 252, 5 month ago, 253, 4 month ago, 254, 3 month ago, 231, 2 month ago, 230, 1 month ago, 229, 3 weeks ago, 228, 2 weeks ago, 227, 1 week ago, 226
12
+[blame]
13
+	date = short
10 14
 [push]
11 15
 	default = simple
12 16
 	autoSetupRemote = true
... ...
@@ -41,18 +41,18 @@ nnoremap <C-k> <C-w>k
41 41
 nnoremap <C-l> <C-w>l
42 42
 
43 43
 " https://levelup.gitconnected.com/7-surprising-vim-tricks-that-will-save-you-hours-b158d23fe9b7
44
-nnoremap d "_d
45
-nnoremap D "_D
46
-nnoremap c "_c
47
-nnoremap C "_C
48
-nnoremap x "_x
49
-nnoremap X "_X
50
-nnoremap <leader>d d
51
-nnoremap <leader>D D
52
-nnoremap <leader>c c
53
-nnoremap <leader>C C
54
-nnoremap <leader>x x
55
-nnoremap <leader>X X
44
+"nnoremap d "_d
45
+"nnoremap D "_D
46
+"nnoremap c "_c
47
+"nnoremap C "_C
48
+"nnoremap x "_x
49
+"nnoremap X "_X
50
+"nnoremap <leader>d d
51
+"nnoremap <leader>D D
52
+"nnoremap <leader>c c
53
+"nnoremap <leader>C C
54
+"nnoremap <leader>x x
55
+"nnoremap <leader>X X
56 56
 
57 57
 " clear search highlights
58 58
 nnoremap <cr> :noh<cr><cr>
... ...
@@ -140,6 +140,10 @@ function! OpenCurrentAsNewTab()
140 140
 endfunction
141 141
 nmap <leader>o :call OpenCurrentAsNewTab()<CR>
142 142
 
143
+" git blame (uses # instead of % for file)
144
+" Delete this line when you install https://github.com/tpope/vim-fugitive
145
+command Blame tabnew | r! git blame #
146
+
143 147
 " pastetoggle
144 148
 nmap <leader>p :set invpaste paste?<cr>
145 149
 
146 150