一つ前のタブに戻るKey mapping
一つ前のウィンドウに戻るには
そこで次のようなKey mappingを定義しました.タブに関する
nnoremap <silent><C-t>p \ :<C-u>execute 'tabnext' g:pre_tabnr<Return> " memorize previous tabpage number if !exists('g:pre_tabnr') let g:pre_tabnr = tabpagenr() endif if !exists('g:cur_tabnr') let g:cur_tabnr = tabpagenr() endif autocmd MyAutoCmd TabLeave * \ if exists('g:pre_tabnr') && exists('g:cur_tabnr') \ | let g:pre_tabnr = g:cur_tabnr \ | endif autocmd MyAutoCmd TabEnter * \ if exists('g:cur_tabnr') \ | let g:cur_tabnr = tabpagenr() \ | endif
Vim scriptで適切な変数のスコープを理解しきれていないのでグローバル変数を使ってもよいのかわかりませんが,一応動きます.
追記
kanaさんが赤ペンしてくれました.ありがとうございます.
Re:一つ前のタブに戻るKey mapping - while ("im the true Vim master");
id:thincaさんがプラグイン(vim-tabrecent)を作成してくれました.
tabrecent.vimを書いてみた - 永遠に未完成