Search the web
Sign In
New User? Sign Up
taglist · Vim taglist (source browser) plugin
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Patch for taglist interaction with autocommands   Message List  
Reply | Forward Message #419 of 444 |
All,

I've been using the following pair of autocommands
to keep Vim from scrolling the my buffers when I switch
them:

if v:version >= 700
autocmd BufLeave * let b:winview = winsaveview()
autocmd BufEnter * if (exists('b:winview')) |
\call winrestview(b:winview) |
\endif
endif

This has an undesirable interaction with the taglist plugin
with these settings:

let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Close_On_Select = 1

After executing :TlistToggle, selecting a tag, and pressing
Enter, the expected behavior is to jump to the location for
that tag. But the above autocommands undo the jump, leaving
the cursor at its original position.

Below is a patch to version 4.5 of taglist.vim that fixes this
behavior. It wraps the :close command with taglist's
s:Tlist_Exe_Cmd_No_Acmds() function to prevent activation
of the autocommand.

It's not clear to me how many other places in taglist.vim might
have a similar interaction. The :close command is used without
suppressing autocommands in several places that could
perhaps have similar unwanted effects.

--- taglist.vim (revision 478)
+++ taglist.vim (working copy)
@@ -3289,7 +3289,7 @@
" tag is selected, close the taglist window
if g:Tlist_Close_On_Select
call s:Tlist_Window_Goto_Window()
- close
+ call s:Tlist_Exe_Cmd_No_Acmds('close')

" Go back to the window displaying the selected file
let wnum = bufwinnr(a:filename)

I've tested the problem and the patch with a clean configuration
of Vim 7.2.191, with the following ~/.vimrc and ~/.vim/ tree:

testuser@t61:~$ cat ~/.vimrc
filetype on
let Tlist_Close_On_Select = 1
let Tlist_GainFocus_On_ToggleOpen = 1
nmap <silent> <s-F8> :TlistToggle<CR>
if v:version >= 700
autocmd BufLeave * let b:winview = winsaveview()
autocmd BufEnter * if (exists('b:winview')) |
\call winrestview(b:winview) |
\endif
endif

testuser@t61:~$ find ~/.vim
/home/testuser/.vim
/home/testuser/.vim/doc
/home/testuser/.vim/doc/taglist.txt
/home/testuser/.vim/plugin
/home/testuser/.vim/plugin/taglist.vim
/home/testuser/.vim/plugin/taglist.vim.orig

Michael Henry




Sat May 30, 2009 9:05 pm

vim@...
Send Email Send Email

Forward
Message #419 of 444 |
Expand Messages Author Sort by Date

All, I've been using the following pair of autocommands to keep Vim from scrolling the my buffers when I switch them: if v:version >= 700 autocmd BufLeave *...
Michael Henry
vim@...
Send Email
May 30, 2009
9:06 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help