Vim: TagList Plugin Slow Update
Asked Answered
G

4

8

I am using Vim with TagList in development. TagList seems to be very nice, but one problem with that is that it takes a long time to refreshe, so if for example I mean from the function A to the function B in the same file, it takes around 5 seconds for TagList to get updated. Is there anyway to make this interval shorter, like half a second for example?

Gummosis answered 31/12, 2010 at 7:36 Comment(6)
5 seconds is too long. I am also using it and it works fine for me. even half second is too much for it. I think the problem is some where else and not with the TagList. I also use ctags and cscope for code browsing and they are very good too. you can try them as well.Renaldorenard
@Gummosis K. Abdullah: did you read this question: #2170145Plus
@eckes, yes I just did, but it is not what I am asking really. Have you used TagList before?!Gummosis
Yeah, I use it with no problems also, but it doesn't update the selected function instantaneously. Like I said in the question, when I move the cursor to another function at takes around 5 seconds for me to see the selection function updated to the current one in the tab to the left.Gummosis
It is also slow for me. Until now I thought it was normal.. Perhaps it has something todo with the ctags, which is the tool TagList is using to generate the method-tree. I'm using Vim on Mac, not Linux, btw (MacVim).Centurial
Then probably we should read its code to figure out how to reduce the time.Gummosis
S
4

You can try setting the updatetime to 1000ms. I did this with a big file and everything is working very well, the refresh occurs every second;

set ut=1000

see if it helps

Straddle answered 18/8, 2015 at 17:31 Comment(1)
this accomplishes what TomYu's solution does via polling but has the same downside as any "polling vs interrupt" driven solution has (i.e. interrupt driven will be faster and won't cause unnecessary operations. (i had to set ut=250 to get the UI responsiveness I wanted. if i really wanted it to be not noticeable I would set it to ut=100 because events that are <250 ms are generally not noticeable by humans)).Thundershower
Y
3

I have the same problem as yours and inspired by ThePosey's answer.

You can find the "autocmd" command on line 1678 in the taglist.vim which looks

autocmd BufEnter * call s:Tlist_Refresh()

that waits for a BufEnter event to refresh the tag window.

I just modified it to

autocmd BufEnter,CursorMovedI * call s:Tlist_Refresh()

and it will toggle Tlist_Refresh while your cursor is moving in insert mode. I deleted CursorMoved event for it hinders too many other commands.

I think this should meet the requirement for most cases. The side effect is some commands that requires moving cursor becomes invalid.

Edit:

An easier way would be put this line in the .vimrc file:

autocmd CursorMovedI * silent! TlistHighlightTag

And BTW, there is no command TlistRefresh, use TlistHighlightTag instead.

Yard answered 29/2, 2012 at 8:17 Comment(1)
I modified your solution slightly because CursorMovedI is only for insert-mode but I wanted normal-mode also: autocmd BufEnter,CursorMoved,CursorMovedI * silent! TlistHighlightTagThundershower
R
1

You can bind a key to the function :TlistRefresh

map <silent> <F1> :TlistRefresh<CR>
Robyn answered 17/3, 2011 at 13:24 Comment(2)
Hmmm... that's a good work around, so since there is no other answer, I will mark this as the accepted answer. But wait, in my case, I suppose there is a 5-sec timer that calls TlistRefresh, yeah? So it might be a good idea to check that and change it. I will let you know if I succeed.Gummosis
Yes I was looking for something in the script that indicated a timer event or something happening however nothing really stuck out at me. The only thing I could figure was happening was a BufEnter event gets generated every 5 seconds. There are debug options to enable :TlistDebug and then :TlistMessages shows you the output. Good luck and please post any better solution.Robyn
J
1

Kind of an old question, but for taglist 4.6 (at least) the update period is controlled by the updatetime (autocmd CursorHold .. line 1735)

For interactivity, Tom Yu's answer is probably the best solution.

Johns answered 4/12, 2013 at 10:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.