Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion plugin/minibufexpl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,9 @@ function! <SID>BuildBufferList(curBufNum)
call add(l:tabList, l:tab)
endfor

if t:miniBufExplSortBy == "name"
if t:miniBufExplSortBy == "number"
call sort(l:tabList, "<SID>NumCmp")
elseif t:miniBufExplSortBy == "name"
call sort(l:tabList, "<SID>NameCmp")
elseif t:miniBufExplSortBy == "mru"
call sort(l:tabList, "<SID>MRUCmp")
Expand Down Expand Up @@ -2000,6 +2002,21 @@ function! <SID>MRUCmp(tab1, tab2)
return index(s:MRUList, l:buf1) - index(s:MRUList, l:buf2)
endfunction

" }}}
" NumCmp - compares tabs based on filename {{{
"
function! <SID>NumCmp(tab1, tab2)
let l:num1 = str2nr(matchstr(a:tab1, ".*:", 1))
let l:num2 = str2nr(matchstr(a:tab2, ".*:", 1))
if l:num1 < l:num2
return -1
elseif l:num1 > l:num2
return 1
else
return 0
endif
endfunction

" }}}
" HasEligibleBuffers - Are there enough MBE eligible buffers to open the MBE window? {{{
"
Expand Down