tagbar icon indicating copy to clipboard operation
tagbar copied to clipboard

Avoid tagbar runs all the time in new opened buffer but on demand

Open niva-xx-zz opened this issue 7 years ago • 8 comments

Hi,

From usage section in help, tagbar is running all the time and each time I open a file in buffer. It pass by vimrun out of job_start( to run ctag executable and update tags I imagine.

How ca I set option in order to disable this 'all the time' mode and switch to 'on demand' mode ?

Thank you

Nota : just opening $MYVIMRC in gvim, tagbar take a lot of time.

FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 5 5.195276 0.038170 <SNR>109_ExecuteCtags() 19 3.518753 0.019814 <SNR>109_AutoUpdate() 3 3.486098 0.099733 <SNR>109_ProcessFile() 3 3.359691 0.001272 <SNR>109_ExecuteCtagsOnFile() 16 3.150940 0.002827 <SNR>178_delete()

niva-xx-zz avatar Feb 03 '18 23:02 niva-xx-zz

background ctags calling takes 5-6 seconds each time on windows.

see my issue: https://github.com/majutsushi/tagbar/issues/475

skywind3000 avatar Feb 04 '18 16:02 skywind3000

Hum OK i understand but is there an option to disable 'always' ctags launch on each opened buffer and launch it on demand.

Le 4 févr. 2018 17:59, "Linwei" [email protected] a écrit :

background ctags calling costs me 5-6s each time on windows.

#475 https://github.com/majutsushi/tagbar/issues/475

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/majutsushi/tagbar/issues/477#issuecomment-362921847, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtp3luwhySb-Z-HslHPmy3F2vL7uOeWks5tReHzgaJpZM4R4Xx1 .

niva-xx-zz avatar Feb 04 '18 17:02 niva-xx-zz

There is an alternative for tagbar, currently I have switch to LeaderF/CtrlP from tagbar. LeaderF/CtrlP can display function list of the current buffer and apply fuzzy match on the function list:

In LeaderF you can use command :LeaderfFunction (bound to my F9) to display a function list like tagbar:

leaderf2

ctags are invoked on demand and executed in the background, and Vim will never get stuck. You can use arrow keys up/down (or c-j/c-k) to navigate between function names or use leaderf's fuzzy matcher to find one.

The only disadvantage of leaderf is python requirement. If you don't get the python support in your vim, you can also use CtrlP which is definitely 100% vimscript.

CtrlP has a plugin ctrlp-funky which provide a :CtrlPFunky command for you to display the function list like LeaderF and enable you using arrow keys or fuzzy match to navigate function names:

687474703a2f2f692e696d6775722e636f6d2f436e4b756935482e706e67

If you don't need them right now, they will never show them up or invoke ctags executable. But if you do, just press F9 to popup the function list and ESC to close it.

Very handy.

skywind3000 avatar Feb 07 '18 18:02 skywind3000

Hi and thank you a lot for this alternative.

CtrpFunky seems fast. But It does not display class with public/private methods like tagbar isn't it ?

Best, Nicholas

2018-02-07 19:49 GMT+01:00 Linwei [email protected]:

There is an alternative for tagbar, currently I have switch to LeaderF/CtrlP from tagbar. LeaderF/CtrlP can display function list of the current buffer and apply fuzzy match on the function list:

In LeaderF you can use command :LeaderfFunction (bound to my F9) to display a function list like tagbar:

[image: leaderf2] https://user-images.githubusercontent.com/3035071/35934809-86eb76c0-0c79-11e8-896b-8e519af092da.png

ctags are invoked on demand and executed in the background. You can use c-j, c-k to navigate between function names or use leaderf's fuzzy matcher to find one.

The only disadvantage of leaderf is python requirement. If you don't get the python support in your vim, you can also use CtrlP https://github.com/ctrlpvim/ctrlp.vim which is definitely 100% vimscript.

CtrlP has a plugin ctrlp-funky https://github.com/tacahiroy/ctrlp-funky which provide a :CtrlPFunky command for you to display the function list like LeaderF and enable you using arrow keys or fuzzy match to navigate function names.

Now I am very happy with them.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/majutsushi/tagbar/issues/477#issuecomment-363870570, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtp3gQarJezUNkVWUOAcmhH39-AyDqYks5tSfBQgaJpZM4R4Xx1 .

niva-xx-zz avatar Feb 15 '18 21:02 niva-xx-zz

Another promising competitor you may have a look: vista

keywords: universal-ctags, lsp, background task, popup-window

skywind3000 avatar Dec 31 '19 16:12 skywind3000

I think fixing this is urgent. Most of the time it doesn't bother me, but opening a big file somewhere and not saving it shouldn't result in a couple seconds of hand and a tags file I never used!

All the talk of alternatives has it's place —I myself use a different plugin for seeking to tags— but lets keep this issue about fixing the originally reported issue in this plugin. Thanks.

alerque avatar May 29 '20 19:05 alerque

In most cases we do need to run when a buffer is opened because even if the sidebar isn't used, the airline might show tags or other jump commands may be invoked.

However we need to make sure the tags parsing doesn't block the UI. This probably means using job control to background the operation, although an interesting side note is that Python runs in a separate process too.

alerque avatar May 30 '20 08:05 alerque

Can this issue be addressed by #656 to avoid running tags on a file greater than a certain size? Or is there something more needed for this issue?

raven42 avatar Sep 24 '20 17:09 raven42