From: Silvio Rhatto Date: Sun, 28 Jul 2024 14:40:22 +0000 (-0300) Subject: Fix: rename nerdtree_workarounds plugin to session_workarounds X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=bbc8784ecd0adae6acb092ba22cbb835ec80193a;p=rhatto%2Fdotfiles%2Fvim.git Fix: rename nerdtree_workarounds plugin to session_workarounds --- diff --git a/vim.dot.link/plugin/nerdtree_workarounds.vim b/vim.dot.link/plugin/session_workarounds.vim similarity index 82% rename from vim.dot.link/plugin/nerdtree_workarounds.vim rename to vim.dot.link/plugin/session_workarounds.vim index 60e4a1c..be51942 100644 --- a/vim.dot.link/plugin/nerdtree_workarounds.vim +++ b/vim.dot.link/plugin/session_workarounds.vim @@ -1,4 +1,4 @@ -" nedtree_workaroungs.vim - NERDTree and session restoration workarounds +" session_workarounds.vim - Session restoration workarounds " " Author: Silvio Rhatto " @@ -7,8 +7,8 @@ " " Useful after restoring sessions between screen size changes (such " as when you share sessions between different computers). -function FixNERDTreeWidth() - " Make sure NERDTree is focuses +function FixWindowWidths() + " Make sure NERDTree is focused execute ":NERDTreeFocus" " Set a fixed width @@ -18,11 +18,11 @@ function FixNERDTreeWidth() wincmd l endfunction -" In case you want to invoke FixNERDTreeWidth explicitly -command! -bang FixNERDTreeWidth :call FixNERDTreeWidth() +" In case you want to invoke FixWindowWidths explicitly +command! -bang FixWindowWidths :call FixWindowWidths() -" Fix NERDTree width on all tabs -function FixAllNERDTreeWidths() +" Fix window widths on all tabs +function FixAllWindowWidths() " Make sure to run this only once if exists("did_fixed_nerdtree_widths") return @@ -31,7 +31,7 @@ function FixAllNERDTreeWidths() " Save the last active window let l:current_win = win_getid() - tabdo :call FixNERDTreeWidth() + tabdo :call FixWindowWidths() " Restore the active window call win_gotoid(l:current_win) @@ -75,9 +75,10 @@ function FixWindowHeights() endif endfunction +" Restore all window sizes function RestoreWindowSizes() call FixWindowHeights() - call FixAllNERDTreeWidths() + call FixAllWindowWidths() endfunction " Fix all window sizes @@ -88,5 +89,5 @@ augroup workaround " This seems to fire only once, but even when there's no session to be " restored. - "autocmd workaround VimEnter * call FixAllNERDTreeWidths() + "autocmd workaround VimEnter * call FixAllWindowWidths() augroup END