aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-28 10:30:49 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-28 10:30:49 -0300
commitd77f88995f3b4485bbf79ea9056c79541751baf5 (patch)
treeed033dd278eeaa2ff921d8f2e984009609e708c0 /vim.dot.link/plugin
parent3e6dc904dfdd0bb6662f026de55ac1cfdffe2742 (diff)
downloadvim-d77f88995f3b4485bbf79ea9056c79541751baf5.tar.gz
vim-d77f88995f3b4485bbf79ea9056c79541751baf5.tar.bz2
Fix: run FixAllNERDTreeWidths() only once
Diffstat (limited to 'vim.dot.link/plugin')
-rw-r--r--vim.dot.link/plugin/nerdtree_workarounds.vim16
1 files changed, 12 insertions, 4 deletions
diff --git a/vim.dot.link/plugin/nerdtree_workarounds.vim b/vim.dot.link/plugin/nerdtree_workarounds.vim
index d0d682e..a78ed0c 100644
--- a/vim.dot.link/plugin/nerdtree_workarounds.vim
+++ b/vim.dot.link/plugin/nerdtree_workarounds.vim
@@ -32,6 +32,11 @@ command! -bang FixNERDTreeWidth :call FixNERDTreeWidth()
" Fix NERDTree width on all tabs
function FixAllNERDTreeWidths()
+ " Make sure to run this only once
+ if exists("did_fixed_nerdtree_widths")
+ return
+ endif
+
" Save the last active window
let l:current_win = win_getid()
@@ -42,14 +47,17 @@ function FixAllNERDTreeWidths()
" An additional, last move to the left pane
wincmd l
+
+ let dir_fixed_nerdtree_widths=1
endfunction
" Fix all NERDTree widths afert session load
augroup workaround
autocmd!
- " This tends to fire for every buffers
- "autocmd workaround SessionLoadPost * call FixAllNERDTreeWidths()
+ " This tends to fire for every buffer
+ autocmd workaround SessionLoadPost * call FixAllNERDTreeWidths()
- " This seems to fire only once
- autocmd workaround VimEnter * call FixAllNERDTreeWidths()
+ " This seems to fire only once, but even when there's no session to be
+ " restored.
+ "autocmd workaround VimEnter * call FixAllNERDTreeWidths()
augroup END