Skip to content

Instantly share code, notes, and snippets.

@sukovec
Created February 27, 2018 17:33
Show Gist options
  • Save sukovec/7950ee8e564dea27146480b0f567d38a to your computer and use it in GitHub Desktop.
Save sukovec/7950ee8e564dea27146480b0f567d38a to your computer and use it in GitHub Desktop.
function! SwitchToBufferNum(num)
let buffers = map(filter(copy(getbufinfo()), 'v:val.listed'), 'v:val.bufnr')
execute "buffer " . buffers[a:num]
endfunction
map <C-F1> :call SwitchToBufferNum(0)<CR>
map <C-F2> :call SwitchToBufferNum(1)<CR>
map <C-F3> :call SwitchToBufferNum(2)<CR>
map <C-F4> :call SwitchToBufferNum(3)<CR>
map <C-F5> :call SwitchToBufferNum(4)<CR>
map <C-F6> :call SwitchToBufferNum(5)<CR>
map <C-F7> :call SwitchToBufferNum(6)<CR>
map <C-F8> :call SwitchToBufferNum(7)<CR>
map <C-F9> :call SwitchToBufferNum(8)<CR>
map <C-F10> :call SwitchToBufferNum(9)<CR>
map <C-F11> :call SwitchToBufferNum(10)<CR>
map <C-F12> :call SwitchToBufferNum(11)<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment