Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added g:easytree_width_auto_fit option

  • Loading branch information...
commit 1d398d885808fc746533f85d4a67c28994835a74 1 parent 708793e
@troydm authored
Showing with 24 additions and 3 deletions.
  1. +8 −3 doc/easytree.txt
  2. +16 −0 plugin/easytree.vim
View
11 doc/easytree.txt
@@ -45,15 +45,15 @@ g:easytree_show_hidden_files (Default: 0)
You can toggle this in easytree buffer using I key
*g:easytree_highlight_cursor_line*
-g:easytree_highlight_cursor_line (Default: 1)
+g:easytree_highlight_cursor_line (Default: 1)
Highlight current line in easytree buffer
*g:easytree_ignore_dirs*
-g:easytree_ignore_dirs (Default: ['*.AppleDouble*','*.DS_Store*'])
+g:easytree_ignore_dirs (Default: ['*.AppleDouble*','*.DS_Store*'])
directory patterns present in the following list won't show up in easytree buffer
*g:easytree_ignore_files*
-g:easytree_ignore_files (Default: ['*.swp'])
+g:easytree_ignore_files (Default: ['*.swp'])
file patterns present in the following list won't show up in easytree buffer
*g:easytree_ignore_find_result*
@@ -64,6 +64,11 @@ g:easytree_ignore_find_result (Default: [])
g:easytree_hijack_netrw (Default: 1)
if this option is enabled directories will be opened using easytree instead of |netrw|
+ *g:easytree_width_auto_fit*
+g:easytree_width_auto_fit (Default: 0)
+ if this option is enabled width of easytree window will be automaticly
+ resized if the longest line width will be greater than the easytree window width
+
============================================================================================
2. USAGE *easytree.vim-usage*
View
16 plugin/easytree.vim
@@ -54,6 +54,10 @@ if !exists("g:easytree_hijack_netrw")
let g:easytree_hijack_netrw = 1
endif
+if !exists("g:easytree_width_auto_fit")
+ let g:easytree_width_auto_fit = 0
+endif
+
python << END
import os,sys,shutil,fnmatch
@@ -672,6 +676,7 @@ function! s:UnexpandDir(fpath,linen)
let linee -= 1
endif
exe 'python vim.current.buffer['.linee.'] = None'
+ call s:WidthAutoFit()
endfunction
function! s:ExpandDir(fpath,linen)
@@ -696,6 +701,7 @@ function! s:ExpandDir(fpath,linen)
call append(linen,lvls.' '.f)
let linen += 1
endfor
+ call s:WidthAutoFit()
return linen
endfunction
@@ -795,6 +801,16 @@ function! s:InitializeTree(dir)
call append(line('$'),' '.f)
endfor
setlocal nomodifiable
+ call s:WidthAutoFit()
+endfunction
+
+function! s:WidthAutoFit()
+ if g:easytree_width_auto_fit
+ let m = max(map(range(1,line('$')),"len(getline(v:val))"))+1
+ if m > winwidth(0)
+ exe 'vertical resize '.m
+ endif
+ endif
endfunction
function! s:OpenEasyTreeFile(location,fpath,mode)
Please sign in to comment.
Something went wrong with that request. Please try again.