Skip to content

Commit be6e1ac

Browse files
author
huzilin
committed
fix bugs
1 parent 04d1abf commit be6e1ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

autoload/buffet.vim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,14 @@ function! buffet#bswitch(index)
361361
endfunction
362362

363363
function! buffet#bnext()
364-
let next_buffer_id = (s:last_current_buffer_id+1)%len(s:buffer_ids)
365-
call buffet#bswitch(next_buffer_id)
364+
let current_buffer_id_i = index(s:buffer_ids, s:last_current_buffer_id)
365+
let next_buffer_id_i = (current_buffer_id_i+2)%len(s:buffer_ids)
366+
call buffet#bswitch(next_buffer_id_i)
366367
endfunction
367368

368369
function! buffet#bprev()
369-
let next_buffer_id = (s:last_current_buffer_id-1)
370-
call buffet#bswitch(next_buffer_id)
370+
let current_buffer_id_i = index(s:buffer_ids, s:last_current_buffer_id)
371+
call buffet#bswitch(current_buffer_id_i)
371372
endfunction
372373

373374
" inspired and based on https://vim.fandom.com/wiki/Deleting_a_buffer_without_closing_the_window

0 commit comments

Comments
 (0)