aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin
diff options
context:
space:
mode:
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