Permalink
Browse files

Check and insert the ending slash

Fixes #321
  • Loading branch information...
1 parent f1acbbc commit 4f996262b633df5b2d4864a50d0b7393bfb02679 @kien committed Dec 2, 2012
Showing with 7 additions and 5 deletions.
  1. +3 −2 autoload/ctrlp.vim
  2. +4 −3 autoload/ctrlp/mrufiles.vim
View
5 autoload/ctrlp.vim
@@ -1395,8 +1395,9 @@ fu! s:samerootsyml(each, isfile, cwd)
endf
fu! ctrlp#rmbasedir(items)
- if a:items != [] && !stridx(a:items[0], s:dyncwd)
- let idx = strlen(s:dyncwd) + ( s:dyncwd !~ '[\/]$' )
+ let cwd = s:dyncwd.( s:dyncwd !~ '[\/]$' ? s:lash : '' )
+ if a:items != [] && !stridx(a:items[0], cwd)
+ let idx = strlen(cwd)
retu map(a:items, 'strpart(v:val, idx)')
en
retu a:items
View
7 autoload/ctrlp/mrufiles.vim
@@ -39,12 +39,13 @@ fu! s:chop(mrufs)
endf
fu! s:reformat(mrufs)
+ let cwd = getcwd()
+ let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : ''
if {s:re}
- let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
+ let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd
cal filter(a:mrufs, '!stridx(v:val, cwd)')
en
- let cwd = getcwd()
- let idx = strlen(cwd) + ( cwd !~ '[\/]$' )
+ let idx = strlen(cwd)
if exists('+ssl') && &ssl
let cwd = tr(cwd, '\', '/')
cal map(a:mrufs, 'tr(v:val, "\\", "/")')

0 comments on commit 4f99626

Please sign in to comment.