Tip #1443: Quick switch buffers in one window
tip karma |
Rating -2/9, Viewed by 727
|
created: |
|
December 25, 2006 17:50 |
|
complexity: |
|
basic |
author: |
|
Johnny |
|
as of Vim: |
|
|
Some times we use tag-jump or some other things to jump from current buffer to another one, But when we want to go back we may found some problems. Yes, may be you can use Ctrl - o to solve this, to jump to a old position, but may be you would like to enhance this, like Visual-Studio's, which use the Ctrl-Tab to swap between two buffers. Here is the tip:
Copy this to your _vimrc
" --ex_GotoLastEditBuffer--
function! g:ex_GotoLastEditBuffer() " <<<
" check if buffer existed and listed
let bufnr = bufnr("#")
if buflisted(bufnr) && bufloaded(bufnr) && bufexists(bufnr)
silent exec bufnr."b!"
else
echohl WarningMsg
echomsg a:msg
echohl None
call g:ex_WarningMsg("Buffer: " .bufname(bufnr). " can't be accessed.")
endif
endfunction " >>>
<<Let "Open in tabs" as easy as Textpad, UltraEdit, PSPad, Editplus |
Shows what function the cursor is in. (for C/C++) >>
Additional Notes
|