Loading ...
Sorry, an error occurred while loading the content.

138244Re: Where to put "set iskeyword+=_" or remove "iskeyword-=_

Expand Messages
  • Ben Fritz
    Jun 19, 2013
    • 0 Attachment
      On Wednesday, June 19, 2013 3:42:37 PM UTC-5, Paul wrote:
      > Coot, I think the problem is that I am working with vim 7.3, patches 1-46. It is a locked down environment, so I've given up trying to upgrade for the next few years (which is not to say that I haven't submitted a request). There is no tex_isk in .../doc/syntax.txt in my install. The commands
      > echo tex_isk
      > echo g:tex_isk
      > yield the error messages:
      > E121: Undefined variable: tex_isk
      > E15: Invalid expression: tex_isk
      > E121: Undefined variable: g:tex_isk
      > E15: Invalid expression: g:tex_isk
      > --------------------------------------------------
      > Ben, Gary,
      > I don't have the authority to write to system-wide files. I tried autocommands and ~/vimfiles/after/syntax/tex.vim. No luck so far. In both cases, the result is that "setg isk?" and "setl isk?" show an underscore *before* enabling syntax, but the local version loses underscore after enabling syntax. I can tell that the local version takes precedence because underscore is no longer a keyword character, based on the fact that i_ctlr-p and i_ctrl-n does word completion only upto an underscore.

      How do you enable syntax? Are you setting it on manually? Or do you have a "syntax on" somewhere in your _vimrc?

      > Here are the details behind my attempt at using autocommand and ~/vimfiles/after/syntax/tex.vim.
      > 1 ~/vimfiles/after/syntax/tex.vim
      > 2 -------------------------------
      > 3 setg isk+=_
      > 4 setlocal isk+=_
      > 5

      This should have worked. Can you check with :scriptnames whether this file actually gets sourced? Hod did you determine the ~ directory? Maybe Vim is looking in a place you didn't expect for $HOME.

      > 6 ~/.vim/after/syntax/tex.vim
      > 7 ---------------------------
      > 8 setg isk+=_
      > 9 setlocal isk+=_
      > 10

      This should work on Unix-like systems but not on Windows, IIUC.

      > 11 ~/_vimrc
      > 12 --------
      > 13 autocmd BufNewFile,BufRead,BufWinEnter *.tex setl isk+=_ | setg isk+=_
      > 14 autocmd BufNewFile,BufRead,BufWinEnter *.bib setg isk+=_ | setl isk+=_
      > 15 filetype on
      > 16 au Syntax * setl isk+=_

      Line 16 should work, at least if "syntax on" is set somewhere above. You should actually be able to be more selective, with "au Syntax tex setl isk+=_" instead of matching ALL syntaxes.

      > I bastardized lines 13-14 from code higher up in the _vimrc, not sure if it is kosher.

      They look fine to me, and the BufWinEnter should even take care of overriding any modelines.

      In summary: you are using 3 methods simultaneously that each ought to be working if the files are actually being sourced. Double-check that these files are being sourced using :scriptnames. If the files do actually show up, try the :verbose set isk? command again. Maybe you can find a specific problematic line.

      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 16 messages in this topic