Thursday, June 7, 2012

Re: Tab Order

On Fri, Jun 1, 2012 at 8:02 PM, Ben Fritz <fritzophrenic@gmail.com> wrote:
> On Thursday, May 31, 2012 10:37:50 PM UTC-5, Scott wrote:
>> Hi Jan,
>>
>> I'd like to be able to make Vim focus the left tab too (after closing a tab). Did you find a way to do it without having to use a new command?
>>
>
> If all you want is the left tab, the link I posted should do that. You can't do it without creating a new command, though.
>
> http://vim.wikia.com/wiki/Have_focus_on_left_tab_after_tabclose
>
> But, you might be able to hack a TabLeave/TabEnter autocmd to do things automatically, or you can use abbreviations to automatically trigger your new command, as mentioned.
>
> http://vim.wikia.com/wiki/Replace_a_builtin_command_using_cabbrev
I tried doing this and ran into an issue..

The script:
au TabEnter * call TabEnterFunc()
au TabLeave * call TabLeaveFunc()

func! TabEnterFunc()
echo 'Enter: ' . tabpagenr("$")
sleep 1
endfunc

func! TabLeaveFunc()
echo 'Leave: ' . tabpagenr("$")
sleep 1
endfunction

If a new tab is created with:
:tabnew
the prints are,
Leave: 1
Enter: 2
(i.e, the number of tabs on TabEnter is one more than when TabLeave
triggered). This is good.

But when we quit a tab with :q, we get,
Leave: 2
Enter: 2

Shouldn't the number of buffers as returned by tabpagenr("$") be
up-to-date by the time TabEnter gets triggered?

:version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 9 2008 18:46:22)
MS-Windows 32-bit GUI version with OLE support
Compiled by Bram@KIBAALE
Big version with GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset
+cindent +clientserver +clipboard +cmdline_compl +cmdline_hist
+cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs -dnd
-ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path
+float +folding -footer +gettext/dyn -hangul_input +iconv/dyn
+insert_expand +jumplist +keymap +langmap +libcall +linebreak
+lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn
+multi_lang -mzscheme +netbeans_intg +ole -osfiletype +path_extra
+perl/dyn
-postscript +printer -profile +python/dyn +quickfix +reltime
+rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff
+statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white +tcl/dyn -tgetent
-termresponse +textobjects +title +toolbar +user_commands +vertsplit
+virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows
+writebackup -xfontset -xim -xterm_save +xpm_w32
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32
-DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_XPM_W32 /Wp64
-DWINVER=0x0400 -D_WIN32_WINNT=0x0400 /Fo.\ObjGOLYTR/ /Ox -DNDEBUG
/Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32
-DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL
-DDYNAMIC_TCL_DLL=\"tcl83.dll\" -DDYNAMIC_TCL_VER=\"8.3\"
-DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python24.dll\"
-DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl58.dll\"
-DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=18
-DDYNAMIC_RUBY_DLL=\"msvcrt-ruby18.dll\" -DFEAT_BIG /Fd.\ObjGOLYTR/
/Zi
Linking: link /RELEASE /nologo /subsystem:windows oldnames.lib
kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib
ole32.lib uuid.lib /machine:i386 /nodefaultlib gdi32.lib version.lib
winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386
/nodefaultlib libcmt.lib oleaut32.lib user32.lib
/nodefaultlib:python24.lib e:\tcl\lib\tclstub83.lib WSock32.lib
e:\xpm\lib\libXpm.lib /PDB:gvim.pdb -debug

(yes, old version - sorry. Will check if the issue is present on a
more recent version, but can't do now).

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: