scrx2
scrx2

Reputation: 2282

Vim autocompletion word with character _ , in python and latex

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=<,>,[,]

Upvotes: 0

Views: 184

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172530

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+=_

Upvotes: 2

Related Questions