Vim autocompletion word with character _ , in python and latex

172 Views Asked by At

In vim, I managed to have autocompletion installing Supertab. When I work on a .py file, it works ok: I can autocomplete xxx_yyy by typing xxTAB (and it pops up options if many xxx_yyy1 xxx_yyy2 exist).

But on a .tex file, if I have already the word xxx_yyy, when I type xxTAB I get the only match xxx.

How can I match xxx_yyy with xxTAB in a .tex file too?

This is my .vimrc :

filetype plugin indent on
syntax on
set backspace=indent,eol,start
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4
set ww=<,>,[,]
1

There are 1 best solutions below

0
Ingo Karkat On BEST ANSWER

SuperTab uses the built-in insert mode completion (:help i_CTRL-N), and that is based on keywords. This setting is filetype-specific, controlled by the 'iskeyword' option. For Python, the _ is included, for Latex, it isn't (and based on @Konrad Rudolph's comment, for a reason).

You can certainly adapt this if it bothers you. In your ~/.vimrc:

autocmd Filetype tex setlocal iskeyword+=_