Restore entire window view when opening in tab
dblume

dblume commited on 2022-03-09 11:33:22
Showing 1 changed files, with 2 additions and 2 deletions.

... ...
@@ -116,9 +116,9 @@ nmap <leader>tm :tabmove
116 116
 " Open current buffer in new tab. Close with C-w,c
117 117
 " https://vim.fandom.com/wiki/Maximize_window_and_return_to_previous_split_structure
118 118
 function! OpenCurrentAsNewTab()
119
-    let l:currentPos = getcurpos()
119
+    let l:currentView = winsaveview()
120 120
     tabedit %
121
-    call setpos(".", l:currentPos)
121
+    call winrestview(l:currentView)
122 122
 endfunction
123 123
 nmap <leader>o :call OpenCurrentAsNewTab()<CR>
124 124
 
125 125