0

I have tags (generated with ctag) of the form

eq:local-canonical-form

Now:

  1. because of the : I cannot use eq:loc<c-x><c-]> to expand the tag.
  2. because of the : and the - I cannot use <c-]> to jump to its definition...

Any ideas how to overcome this?

7
  • Try :set iskeyword+=:. If it helps, you can put setlocal iskeyword+=: into ~/.vim/after/ftplugin/tex.vim. BTW recommended by vim-latex aka latex-suite.
    – Hotschke
    Commented Nov 17, 2018 at 13:56
  • that's neat. it works for both these characters!!
    – Jan
    Commented Nov 17, 2018 at 14:20
  • actually I'm trying to get some vim-latex functionality to rmarkdown
    – Jan
    Commented Nov 17, 2018 at 14:27
  • @Hotschke i think that could be an answer?
    – D. Ben Knoble
    Commented Nov 17, 2018 at 15:49
  • @D.BenKnoble: For me it looks like this question is a duplicate of vi.stackexchange.com/questions/16686/…. However, if you do not know what iskeyword is, the title is not very helpful. Oh, no this question wants the opposite. My mistake.
    – Hotschke
    Commented Nov 17, 2018 at 15:54

1 Answer 1

1

By default, in vim (and most other editors) : and - separate words. This means word/tag completion do not complete eq:loc<c-x><c-]> but only loc<c-x><c-]>. If there is no tag loc..., nothing happens.

You can fix this by placing

setlocal iskeyword+=:
setlocal iskeyword+=-

in ~/.vim/after/ftplugin/tex.vim and/or ~/.vim/after/ftplugin/rmd.vim (rmd=rmarkdown).

However, this might have surprising side effects. For instance, if you have the equation a-b:2, it is now treated as a single word.

The situation in latex is known to be complicated:

You can't get all LaTeX strings right using iskeyword, that is because the iskeyword works on characters and some characters may have different meanings in different contexts. (from iskeyword for latex)

Someone already asked the question iskeyword with context. But the answer is not affirmative to solve this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.