Konfekt / FastFold

Speed up Vim by updating folds only when called-for.
708 stars 24 forks source link

Conflict with taglist #40

Open ktkimit opened 8 years ago

ktkimit commented 8 years ago

When I use this with "taglist" plugin, there is a problem.

If I open "Tlist" with several files as buffers, and if I move to other buffer by typing "bp", I got sometimes an error message like:


Error detected while processing fuction 30_Tlist_Refresh[93]..30_Tlist_Window_Refresh_File[140]..30_Tlist_Create_Folds_For_File: line 10: E350: Cannot create fold with current 'foldmethod' E350: Cannot create fold with current 'foldmethod' E350: Cannot create fold with current 'foldmethod' line 15: E350: Cannot create fold with current 'foldmethod'


Also, in the Tlist, all the foldings are removed (setting is "foldmethod=syntax").

I will appreciate your comments.

Thank you!

Konfekt commented 8 years ago

Does it go away by commenting out

    if exists('##OptionSet')
      autocmd OptionSet foldmethod call s:UpdateBuf(0)
    endif

?

Konfekt commented 8 years ago

By default, master now disables this autocmd. Give it a try please.

ktkimit commented 8 years ago

I re-installed fastfold, but it still does not work.

Konfekt commented 8 years ago

Do you have foldmethod=syntax in your vimrc? Could you paste all settings of Fastfold and taglist? Which version of taglist is it?

ktkimit commented 8 years ago

I do not give any settings for Fastfold and taglist. The version of taglist is "February 26, 2013: Version 4.6" which is the latest one.

Yes, I have "foldmethod=syntax" in my vimrc.

Konfekt commented 8 years ago

Ok, so does it go away if the setting is removed? It's hard to pinpoint the conflicting autocmds and after all set foldmethod=global is a bad suggestion as this issue shows. It must be set for each file type.

Konfekt commented 8 years ago

See, the correct foldmethod for the taglist filetype is that set by taglist, manual, but somehow at some point fastfold uses the global one which is wrong as the filetype must know how to handle it.

ktkimit commented 8 years ago

Which setting do you mean? I have the problem when I have "foldmethod=syntax" in my vimrc.

Konfekt commented 8 years ago

Yes, supposedly it goes away without. Because at some point the foldmethod is set to syntax and erroneously conserved by FastFold.

Konfekt commented 8 years ago

And the setting is too coarse. Because many file types do not support syntax folding.

The thing is that fixing it seems impossible through FastFold other than by adding exceptions for Taglist.

Instead, the clean route is explicitely enabling foldmethod syntax for all file types you use.

Konfekt commented 8 years ago

If setglobal fdm=syntax must be kept, then there is now

let g:fastfold_skip_filetypes = [ 'taglist' ]

to work around this issue.

ktkimit commented 8 years ago

Thanks Konfekt, with the option you gave, it becomes better, but it still sometimes gives the same error ( not many as before).

Konfekt commented 8 years ago

With the global foldmethod syntax? Better unset it. There's a warning against it in the docs now.

If there is an error, what's the filetype like?

ktkimit commented 8 years ago

In my _vimrc, I have

..... let g:fastfold_skipfiletypes = [ 'taglist' ] .... autocmd bufnewfile,bufread .f,_.f90 set foldmethod=syntax ....

When I make FORTRAN code, I use taglist with it. What do you mean by the global foldmethod syntax?

Konfekt commented 8 years ago

Ah, the global foldmethod is that set outside of autocmds.

You should change the autocmd to

autocmd bufnewfile,bufread *.{f,.f90} setlocal foldmethod=syntax

to make sure everything works as intended.

ktkimit commented 8 years ago

It looks like it works!

Thank you Konfekt, you are really helpful~

Konfekt commented 8 years ago

No problem! Seems the previous erroneous autocmd pattern erroneously set the foldmethod to syntax in the taglist buffers as well.

When asking for a global syntax foldmethod setting, I thought it was for all buffers. Turns out the autocmd pattern was just so that it also set the foldmethod of the taglist buffers.

ktkimit commented 8 years ago

I thought that it solves, but I got the same error again even if I set "autocmd bufnewfile,bufread *.{f,.f90} setlocal foldmethod=syntax"

Konfekt commented 8 years ago

That should read

autocmd bufnewfile,bufread *.{f,f90} setlocal foldmethod=syntax

That is, f90 instead of .f90. Are you using let g:fastfold_skip_filetypes = [ 'taglist' ] ?

ktkimit commented 8 years ago

I am using the correct setting:

autocmd bufnewfile,bufread *.{f,f90} setlocal foldmethod=syntax

and also using

let g:fastfold_skip_filetypes = [ 'taglist' ]

Konfekt commented 8 years ago

Can you post the output of :set filetype? when the error appears?

ktkimit commented 8 years ago

When I type it in the taglist's window it says "filetype=taglist", but when I type it in the fortran's window it says "filetype=fortran".

The error appears when I move between such two windows or when I move the other buffers by using "bn" or "bp". Also, foldings disappear in the taglist's window.

Konfekt commented 8 years ago

Try putting

autocmd bufnewfile,bufread *.{f,f90} setlocal foldmethod=syntax

Konfekt commented 8 years ago

Try putting

autocmd bufnewfile,bufread *.{f,f90} setlocal filetype fortran

into a ftdetect/fortran.vim file and

setlocal foldmethod=syntax

into ftplugin/fortran.vim

Instead of the current autocmd. Does that change anything ?

ktkimit commented 8 years ago

There is no such file in ftdetect folder.

I put setlocal foldmethod=syntax into ftplugin/fortran.vim, but there is no change.

Konfekt commented 8 years ago

Yeah, you should create it if it does not exist. Or does already recognize these file extensions as fortran files ?

ktkimit commented 8 years ago

Sorry for late reply. I think so. It still does not work.

Konfekt commented 7 years ago

Well, I think in all honesty, I probably won't resolve this. Would you mind updating taglist by

https://github.com/majutsushi/tagbar ?

Konfekt commented 6 years ago

The file type skipping was broken and has been fixed. If you could try again?