'Blame' in vim restores your current position
dblume

dblume commited on 2023-04-25 16:42:45
Showing 1 changed files, with 2 additions and 0 deletions.

... ...
@@ -146,8 +146,10 @@ nmap <leader>o :call OpenCurrentAsNewTab()<CR>
146 146
 " git blame, show, and diff
147 147
 " Delete these functions when you install https://github.com/tpope/vim-fugitive
148 148
 function! GitBlame()
149
+    let l:currentView = winsaveview()
149 150
     let l:fname = expand('%:t')
150 151
     exec 'tabnew | r! git blame ' . shellescape(expand('%'))
152
+    call winrestview(l:currentView)
151 153
     setl buftype=nofile
152 154
     exec 'silent :file git blame ' . l:fname
153 155
 endfunction
154 156