# vim iskeyword for latex

I am using vim. I also asked this question on vi-vim SX. I hope this question is acceptable for TeX-SX.

## Context

Currently, when I set ft=tex, my set isk? reads

iskeyword=@,48-57,_,192-255


that is, the default for vim.

## My "issue"

Currently, in a LaTeX string such as

$\abcde_\fgh$


the w jump would take me from the start to

1. a
2. \
3. f
4. $ Thus, the above setting does not feel very natural, nor optimal. Indeed, it would probably be more reasonable to jump to 1. \ 2. _ 3. \ 4. $

## My attempt

I'm thinking of something more like set iskeyword=\,192-255 so as to have words consist of characters that would fit in

• natural language words
• or LaTeX commands.

## Questions

1. Is it supposed to be so ? yes, since it is the default
2. What are better settings ?
3. How to properly set this variable for this filetype ?

Cheers,

• :h isk suggests that @,48-57,_,192-255 is the default for a non-Windows platform, and also that iskeyword can be ignored by a syntax file. If you look in your runtime at syntax/tex.vim and search for isk you will see that it is indeed ignored by the standard TeX syntax settings in Vim. So I don't think you need to worry about it. Apr 17, 2017 at 21:38
• Well, I would like to have it changed; something like set isk-=_ and set isk+=\  probably, but not too sure... Apr 17, 2017 at 21:48

Using @ (meaning all alphabetic characters) is advisable, then 192-255 and other utf8 accentuated characters and ligatures should be directly included.
Adding or not numbers is a personal choice — maybe convenient not to, so if you have $2ab$ and press * on ab you search for this and not 2ab.
Adding \ is probably a bad idea, because then a\alpha and a\right in a\right) will be a single word. As far as I am aware, it is not possible to add characters to iskeyword with a condition on their position in the keyword, which would solve that issue.
Finally, my settings for LaTeX are set iskeywords=@,_.