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

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

Expand Messages
  • Gary Johnson
    ... I agree with everything you said, but I was wondering why just setting $HOME in _vimrc didn t work to set rtp . :help startup says that _vimrc is
    Message 1 of 16 , Jun 20, 2013
    • 0 Attachment
      On 2013-06-20, Ben Fritz wrote:
      > On Thursday, June 20, 2013 10:33:52 AM UTC-5, Paul wrote:
      > >
      > > The problem is essentially solved that this point. What follows
      > > describes what I did in response to your advice on checking
      > > whether $HOME/vimfiles/after/syntax/tex.vim runs -- it does not.
      > > The word "after" doesn't even show up in the :scriptnames
      > > listing below. I think I will save that for another day. But
      > > if you have any suggestions (without going out of your way to
      > > dig), I'd be happy to follow up to the extent that I can.
      > >
      > > Thanks !!
      > > --------------------------------------------------
      > > "~" is my short hand for $HOME, which I set in my personal _vimrc via:
      > >
      > > let $HOME=$USERPROFILE."/Documents"
      > > set rtp^=$HOME/vimfiles
      > >
      >
      > AHA!
      >
      > Note from :help 'runtimepath' that the "after directory" is only
      > used normally, because the default value of 'runtimepath' contains
      > $HOME/vimfiles/after as the last entry.
      >
      > Since you have moved your $HOME directory after Vim started up,
      > you wisely re-inserted the new vimfiles location into the
      > runtimepath. But, you did NOT re-insert the vimfiles/after
      > directory!
      >
      > If you do not have other programs that pay attention to the HOME
      > environment variable, you may be better off setting it directly on
      > your system. Otherwise, you could modify your Vim shortcuts and
      > .bat files and such to set HOME for you just before launching Vim.
      > Or continue in the way you are doing things, but add a "set
      > rtp+=$HOME/vimfiles/after" to your .vimrc.

      I agree with everything you said, but I was wondering why just
      setting $HOME in _vimrc didn't work to set 'rtp'.

      ":help startup" says that _vimrc is sourced in step 3 and plugins
      are sourced according to 'rtp' in step 4. I would think that 'rtp'
      would be evaluated at step 4 according to the current value of
      $HOME, which in the present case was set in step 3. That's not what
      happens, though.

      I set up an experiment. I created two "HOME" directories in my
      actual $HOME directory. In each I created a minimal .vim hierarchy.
      In one I put a .vimrc file that set $HOME to the other directory.
      Then I executed vim with HOME set to the first directory and
      executed :scriptnames to see which value of $HOME was used by 'rtp'
      when the plugin was sourced.

      $ cd
      $ mkdir -p a/.vim/after/plugin
      $ touch a/.vim/after/plugin/foo.vim
      $ mkdir -p b/.vim/after/plugin
      $ touch b/.vim/after/plugin/foo.vim
      $ echo 'let $HOME="/home/gary/b"' > a/.vimrc
      $ HOME=/home/gary/a vim
      :scriptnames

      I expected the last item in the output of ":scriptnames" to be

      /home/gary/b/.vim/after/plugin/foo.vim

      but instead it was

      /home/gary/a/.vim/after/plugin/foo.vim

      I even changed /home/gary/a/.vimrc to this:

      let $HOME="/home/gary/b"
      set rtp=
      set rtp&

      to force 'rtp' to be re-set with the current value of $HOME, but the
      results were the same.

      This doesn't seem right. Does anyone have an explanation.

      I was using Vim 7.3.882 on Fedora 11.

      Regards,
      Gary

      --
      --
      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.
    • Paul
      Ben, thanks for pointing out the need to modify my rtp after setting $HOME: let $HOME=$USERPROFILE. /Documents set rtp^=$HOME/vimfiles set
      Message 2 of 16 , Jun 21, 2013
      • 0 Attachment
        Ben, thanks for pointing out the need to modify my rtp after setting $HOME:

        let $HOME=$USERPROFILE."/Documents"
        set rtp^=$HOME/vimfiles
        set rtp+=$HOME/vimfiles/after

        The file $HOME/vimfiles/after/syntax/tex.vim is now executed when syntax is enabled in a tex file:

        setg isk+=_
        setlocal isk+=_

        I don't want to mess around with $HOME in the larger Windows 7 environment because I don't control how IT works around here. If it doesn't break something now, it could break something in the distant future when I've all but forgotten about this little customization. So I will localize the customization to vim.

        Gary, being the weekend warrior that I am, I don't think I can respond authoritatively about when rtp is set relative to the sourcing of _vimrc, but here's my take.

        In ":help startup", step 4 uses :runtime. The help for :runtime sounds like it presumes that rtp is already set. So it looks like there isn't really basis for assuming that rtp is set at step 4. I can't find documentation on where it is set, but it could very well be set before any of the numbered startup steps. For that matter, the default value for rtp might be captured early on as well, which could explain why "set rtp&" still gets you the rtp resulting from the $HOME that is in effect when vim is executed.

        --
        --
        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.
      Your message has been successfully submitted and would be delivered to recipients shortly.