davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.28k stars 370 forks source link

Including python syntax sets conceillevel (bad interaction with LaTeX buffers) #440

Open Rmano opened 9 years ago

Rmano commented 9 years ago

Hi --- I have installed jedi-vim and I find it really nice to edit python files. But I came across a problem that I am unable to solve --- it makes editing of LaTeX files much more complex. The problem is the following. I have in my .vimrc:

Plug 'davidhalter/jedi-vim'
    autocmd FileType python setlocal completeopt-=preview 

And when I edit a LaTeX file, the $...$ marks that define an inline math disappears unless the line is under the cursor. See:

Case 1, cursor in different line of the math formula (the cursor does not appear on screenshot, but believe me...)

selection_036

Case 2, few instant after, cursor in the same line:

selection_037

This make LaTeX files almost impossible to edit. Is there a way to restrict all of the jedi-vim effects to python buffers?

PD I checked that commenting out the plugin will remove the problem.

Rmano commented 9 years ago

The problem (see http://vi.stackexchange.com/questions/3999/jedi-vim-and-vim-latex-buffers-problems ) seems to be that --- I do not know why --- the set conceallevel=2 get triggered for LaTeX buffers. Adding

autocmd FileType tex set concealleval=0 

fixes the issue. Still, I am quite confused --- maybe a strange interaction with my .vimrc? Puzzled.

blueyed commented 9 years ago

I am re-opening the issue. There's likely something that jedi-vim could do better for this case, see http://vi.stackexchange.com/questions/3999/jedi-vim-and-vim-latex-buffers-problems#comment5775_4001 and the other comments.

Rmano commented 9 years ago

I am not sure, but I think that the problem is (could be) that vimtex loads the syntax file for sub-syntax formatting (as in listing environments containing python code). See around line 66 in https://github.com/lervag/vimtex/blob/master/after/syntax/tex.vim

Probably the only solution is that the set conceallevel should be done in another place, not in the syntax definition file --- but do not trust me, I am a newbie in this.

blueyed commented 9 years ago

Probably the only solution is that the set conceallevel should be done in another place

Yeah, that's what I'd say, too - probably in the the filetype plugin instead.

It's tied to setting the conceil syntax, and maybe could be done when setting up / tearing down the call signatures.

davidhalter commented 9 years ago

It's tied to setting the conceil syntax, and maybe could be done when setting up / tearing down the call signatures.

True. However, I'm not sure if it's necessary.

blueyed commented 7 years ago

There is better support for setting up call signatures in #652, e.g. not setting conceallevel at all when using another mode than 1.