0

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=<,>,[,]
scrx2
  • 2,242
  • 1
  • 12
  • 17
  • I don’t know Supertab but the LaTeX behaviour is correct, since in LaTeX `foo_bar` *isn’t* one word: `_` is not valid in macro names, and in general it’s a special character that adds subscript in math mode (and creates an error in normal mode, which is unfortunate). – Konrad Rudolph Nov 10 '15 at 15:34
  • @Konrad Rudolph : I find it useful to retrieve for example all the figure names when referencing them with the `\label{}` : `\ref{fig_bla1}` Vs `\ref{fig_bla2}` – scrx2 Nov 10 '15 at 15:38

1 Answers1

2

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+=_
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324