Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed incompatibility with tilde characters in filenames

When trying to open files that have a tilde in the name, the search
function in <SID>StartExplorer (roughly line 120 of the function)
interprets the tilde character as a search special character,
specifically matching the last given substitute string (:h /~). Since
this is probably not what was desired when expanding the buffer name, I
have pulled the code from [here], specifically for escaping the tilde
character. I'm not certain why this bit hasn't been pulled, since there
is a pull [request] for it, but it's possible it's because the requester
had a [commit] that was more or less a complete deletion of the plugin.

So anyways, I'm hoping that this request will be pulled, because I
really enjoy this plugin and I want it to work well with the Man plugin
(which names buffers as "<man page name>.~"). The code I pulled was
written by "rmercado", or r_mercado at o2 dot co dot uk, but I haven't
included any of the work that makes MiniBufExplorer work with vim 7.0,
since that's outside the scope of my use.

  • Loading branch information...
commit 1bef1947997060c4cebbaf1951ebb89686571bf8 1 parent 74e8194
@futuro futuro authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 plugin/minibufexpl.vim
8 plugin/minibufexpl.vim
@@ -689,6 +689,11 @@ augroup NONE
" }}}
" Functions
+" EscapeTilde - escapes "~" {{{
+function! <SID>EscapeTilde(str)
+ return substitute(a:str, "\\\~","\\\\\~","g")
+" }}}
" StartExplorer - Sets up our explorer and causes it to be displayed {{{
@@ -819,7 +824,8 @@ function! <SID>StartExplorer(sticky,delBufNum,currBufName)
call <SID>DisplayBuffers(a:delBufNum,a:currBufName)
if (l:curBuf != -1)
- call search('\['.l:curBuf.':'.expand('#'.l:curBuf.':t').'\]')
+ let l:bname = <SID>EscapeTilde(expand('#'.l:curBuf.':t'))
+ call search('\['.l:curBuf.':'.l:bname.'\]')
call <SID>DEBUG('No current buffer to search for',9)
Please sign in to comment.
Something went wrong with that request. Please try again.