nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 3b98a7fcae8f9fff356907171f0406ff8cd28921
parent f8fd2ecce20f5005e6313ce57d6d2a209890c946
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date:   Thu, 20 Nov 2014 11:02:17 +0000

Merge pull request #403 from gcmt/pretty-cwd

Pretty CWD
Diffstat:
Mlib/nerdtree/path.vim | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim
@@ -623,8 +623,13 @@ function! s:Path.str(...)
 
     if has_key(options, 'truncateTo')
         let limit = options['truncateTo']
-        if len(toReturn) > limit
-            let toReturn = "<" . strpart(toReturn, len(toReturn) - limit + 1)
+        if len(toReturn) > limit-1
+            let toReturn = toReturn[(len(toReturn)-limit+1):]
+            if len(split(toReturn, '/')) > 1
+                let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'
+            else
+                let toReturn = '<' . toReturn
+            endif
         endif
     endif