Last active
February 23, 2018 01:13
-
-
Save colindresj/d4b31211d6df346e48b4f47509b4548a to your computer and use it in GitHub Desktop.
nerdtree_plugin/toggle_width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" put this script in ~/.vim/nerdtree_plugin/ | |
call NERDTreeAddKeyMap({ | |
\ 'key': 'w', | |
\ 'callback': 'NERDTreeToggleWidth', | |
\ 'quickhelpText': 'Toggle window width' }) | |
function! NERDTreeToggleWidth() | |
let l:maxi = 0 | |
for l:z in range(1, line("$")) | |
let l:aktlen = len(getline(l:z)) | |
if l:aktlen > l:maxi | |
let l:maxi = l:aktlen | |
endif | |
endfor | |
exe "vertical resize " . (l:maxi == winwidth(".") ? g:NERDTreeWinSize : l:maxi) | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment