vi uses dash and space as word separators. is there any way to exclude dash from word separators ?

This is required to work with the symbols generated by ctags exe. when symbol contain a "-" ,vi tags fails to locate that even though symbol is generated properly.

For example Symbol - EX01-VAR-LOCAL when using the ctrl+] to search tag for this, vi looks only for EX01 not the complete symbol EX01-VAR-LOCAL

although if used with vi -t EX01-VAR-LOCAL or in command mode :tag EX01-VAR-LOCAL works fine.

i am looking for the solution for vi editor only not vim

Thanks in advance :)


I don't have access to a true vi, only elvis, nvi, and vim. In vim :set lisp will treat - as part of a word, rather than as a separator for both tags and motion. elvis does not (documentation claims it's unimplemented and does nothing), and nvi responds that :set lisp is unimplemented.

Update: a lightly updated vi, http://ex-vi.sourceforge.net/ does indeed handle "-" as part of words for tag purposes (but not motion) when :set lisp is active.

  • Not sure if "only ... vim" is the right term! (-:
    – Rob Wells
    Jul 26 '13 at 18:22

See the help for 'iskeyword' in vim.

:help 'iskeyword'
  • Thank you @musiphil. That was a very helpful pointer and helped me to fix a similar issue with a different filetype. Jan 16 '13 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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