Better filename expansion for git diff; replace mode workaround
dblume

dblume commited on 2023-02-12 00:31:25
Showing 2 changed files, with 7 additions and 1 deletions.

... ...
@@ -22,6 +22,8 @@ function! s:gotoline()
22 22
 		return
23 23
 	endif
24 24
 
25
+	" Don't commit this change. Just testing vimrc Diff command.
26
+
25 27
 	let file_name = names[1]
26 28
 	let line_num  = names[2] == ''? '0' : names[2]
27 29
 	let  col_num  = names[3] == ''? '0' : names[3]
... ...
@@ -160,7 +160,7 @@ endfunction
160 160
 command Show :call GitShow()
161 161
 
162 162
 function! GitDiff()
163
-    let l:fname = expand('%:t')
163
+    let l:fname = expand('%:.')
164 164
     let l:buf = winbufnr(0)
165 165
     exec ':tabnew | r! git show HEAD:$(git rev-parse --show-prefix)' . l:fname
166 166
     setl buftype=nofile
... ...
@@ -419,3 +419,7 @@ let g:airline#extensions#wordcount#enabled = 0
419 419
 let g:rooter_patterns = ['.git', 'Makefile', 'builds/']
420 420
 let g:rooter_cd_cmd = 'lcd'
421 421
 let g:rooter_manual_only = 1
422
+
423
+" In some environments, Vim starts in replace mode:
424
+" https://superuser.com/questions/1284561/why-is-vim-starting-in-replace-mode
425
+" set t_u7=
422 426