dblume commited on 2022-03-09 10:34:28
Showing 1 changed files, with 11 additions and 3 deletions.
... | ... |
@@ -112,8 +112,15 @@ nmap <leader>tn :tabnew |
112 | 112 |
nmap <leader>to :tabonly<cr> |
113 | 113 |
nmap <leader>tc :tabclose<cr> |
114 | 114 |
nmap <leader>tm :tabmove |
115 |
-" Opens a new tab with the current buffer's path |
|
116 |
-nmap <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/ |
|
115 |
+ |
|
116 |
+" Open current buffer in new tab. Close with C-w,c |
|
117 |
+" https://vim.fandom.com/wiki/Maximize_window_and_return_to_previous_split_structure |
|
118 |
+function! OpenCurrentAsNewTab() |
|
119 |
+ let l:currentPos = getcurpos() |
|
120 |
+ tabedit % |
|
121 |
+ call setpos(".", l:currentPos) |
|
122 |
+endfunction |
|
123 |
+nmap <leader>o :call OpenCurrentAsNewTab()<CR> |
|
117 | 124 |
|
118 | 125 |
" pastetoggle |
119 | 126 |
nmap <leader>p :set invpaste paste?<cr> |
... | ... |
@@ -149,9 +156,10 @@ vnoremap <leader>s :sort<cr> |
149 | 156 |
vnoremap < <gv |
150 | 157 |
vnoremap > >gv |
151 | 158 |
|
159 |
+" TODO: Delete this MaximizeToggle(), use OpenCurrentAsNewTab() instead. |
|
152 | 160 |
" Make <C-W>o toggle maximizing a window. |
153 | 161 |
" https://vim.fandom.com/wiki/Maximize_window_and_return_to_previous_split_structure |
154 |
-nnoremap <C-W>o :call MaximizeToggle()<CR> |
|
162 |
+"nnoremap <C-W>o :call MaximizeToggle()<CR> |
|
155 | 163 |
function! MaximizeToggle() |
156 | 164 |
if exists("s:maximize_session") |
157 | 165 |
exec "source " . s:maximize_session |
158 | 166 |