Created
October 22, 2009 15:51
-
-
Save c9s/216031 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun! BufferNext() | |
let c = bufnr('%') | |
let last = bufnr("$") | |
while 1 | |
let c = c + 1 | |
if c > last | |
let c = 1 | |
endif | |
if bufexists(c) != -1 | |
exec c . 'buf!' | |
redraw | |
echo "Buffer " . c . ' [ '.bufname('%').' ]' | |
break | |
endif | |
endwhile | |
endf | |
fun! BufferPrevious() | |
let c = bufnr('%') | |
let head = 1 | |
while 1 | |
let c = c - 1 | |
if c < head | |
let c = bufnr('$') | |
endif | |
if bufexists(c) != -1 | |
exec c . 'buf!' | |
redraw | |
echo "Buffer " . c . ' [ '.bufname('%').' ]' | |
break | |
endif | |
endwhile | |
endf | |
nnoremap <silent> <C-c>j :call BufferNext()<CR> | |
nnoremap <silent> <C-c>k :call BufferPrevious()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment