Permalink
Browse files

Filter by buffer number when the argument is numeric.

  • Loading branch information...
1 parent d9ccf7b commit 731f4a0238be7fa9f978b4715b97ec7dc71944ed @Raimondi committed May 5, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 plugin/buffalo.vim
View
@@ -54,10 +54,15 @@ function! s:buffalo(...)
" Backspace, remove the last char.
let partial = matchstr(partial, '^.*\ze.')
endif
- " fnameescape() doesn't escape '.'
- " second escape of '\\' because enclosed in ""
- let filter = 'fnamemodify(v:val["name"], ":p") =~ "'
- \ . escape(escape(fnameescape(partial), '.'), '\\') . '"'
+ if partial =~ '\d\+'
+ " Filter by buffer number when the partial is numeric.
+ let filter = 'v:val["number"] =~ "'.partial.'"'
+ else
+ " fnameescape() doesn't escape '.'
+ " second escape of '\\' because enclosed in ""
+ let filter = 'fnamemodify(v:val["name"], ":p") =~ "'
+ \ . escape(escape(fnameescape(partial), '.'), '\\') . '"'
+ endif
let bl = g:vimple#bl.filter(filter)
if len(bl.buffers().to_l()) == 1
\ && (!exists('g:buffalo_autoaccept') || g:buffalo_autoaccept)

0 comments on commit 731f4a0

Please sign in to comment.