Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

v:oldfiles in choices

  • Loading branch information...
commit de062f1f51630db9038c8048d8f00c0a3b5a269f 1 parent fd69b0f
@adaszko authored
Showing with 14 additions and 3 deletions.
  1. +1 −0  README.md
  2. +13 −3 autoload/chbuf.vim
View
1  README.md
@@ -30,6 +30,7 @@ Just add a mapping of your choice to `.vimrc`:
To Do
=====
+ * Spaces should indicate start of another pattern
* Implement matching algorithm more suitable for buffer names
* Make functions script-private once they are sufficiently tested
* Tiny screencast
View
16 autoload/chbuf.vim
@@ -1,4 +1,3 @@
-" TODO Include v:oldfiles in buffers list
" TODO Make <C-s>, <C-v> and <C-t> open splits or tab respectively for selected buffer
@@ -36,8 +35,9 @@ function! SwitchToPath() dict " {{{
execute 'silent' 'edit' self.path
endfunction " }}}
-function! BufferFromPath(path) " {{{
- return {'switch': function('SwitchToPath')}
+function! BufferFromPath(path, score) " {{{
+ let name = split(a:path, s:directory_separator)[-1]
+ return {'path': a:path, 'name': name, 'score': a:score, 'switch': function('SwitchToPath')}
endfunction " }}}
function! ScoredBuffers() " {{{
@@ -71,6 +71,16 @@ function! ScoredBuffers() " {{{
call add(result, BufferFromNumber(buffer, name, score))
endfor
+ for path in v:oldfiles
+ let score = 0
+
+ if !filereadable(path)
+ let score -= 100
+ endif
+
+ call add(result, BufferFromPath(path, score))
+ endfor
+
return result
endfunction " }}}
Please sign in to comment.
Something went wrong with that request. Please try again.