From 96bd4b37f4459f30cc6963142aff6697e42bf69e Mon Sep 17 00:00:00 2001 From: Kien N Date: Tue, 29 May 2012 13:48:56 +0700 Subject: [PATCH] Use a custom pathshorten --- autoload/ctrlp.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index c2a08f2..36bafa5 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -1170,7 +1170,12 @@ endf " Paths {{{2 fu! s:formatline(str) let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str) - retu '> '.( cond ? pathshorten(a:str) : a:str ) + retu '> '.( cond ? s:pathshorten(a:str) : a:str ) +endf + +fu! s:pathshorten(str) + retu matchstr(a:str, '^.\{9}').'...' + \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') endf fu! s:dircompl(be, sd)