nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit ba2604474632ebcbf014baaffb026194556c3476
parent f8fd2ecce20f5005e6313ce57d6d2a209890c946
Author: Giacomo Comitti <giacomit@gmail.com>
Date:   Thu, 20 Nov 2014 07:50:47 +0100

Truncate paths at slashes.

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