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

weird 'rtp' problem

Expand Messages
  • Hari Krishna Dara
    Vim6.2 on W2K I am modifying rtp from my .vimrc and I find that it is causing trouble in finding help files. Though a particular directory exists in rtp ,
    Message 1 of 6 , Jun 30, 2003
    • 0 Attachment
      Vim6.2 on W2K

      I am modifying 'rtp' from my .vimrc and I find that it is causing trouble
      in finding help files. Though a particular directory exists in 'rtp',
      the help files under the doc directory are not found by the :help
      command (and yes, I did run :helpt, actually several times). I could
      even narrow it down to the following code in the vimrc. To reproduce it,
      please do the following:

      - Go to a temp directory, say /tmp/vim.
      - Set HOME to the current directory. Setting it to "." should suffice.
      - Create .vimrc file with the following as the contents:

      let $HOME='c:/hari'
      let $VIMPACKAGE='~/package/vim'

      " Remove unnecessary paths as we know where to find the files.
      set runtimepath-=~/vimfiles
      set runtimepath-=~/vimfiles/after
      set runtimepath-=~/.vim
      set runtimepath-=~/.vim/after
      set runtimepath-=$VIM/vimfiles
      set runtimepath-=$VIM/vimfiles/after

      let &runtimepath = $VIMPACKAGE . ',' . &runtimepath

      - Adjust the HOME directory to your actual home directory and
      VIMPACKAGE to the directory containing plugin, doc etc.
      (~/vimfiles or ~/.vim, make sure you use ~ instead of the fullpath).
      - Now start vim.


      As the HOME directory is the current directory, it should pick the .vimrc
      that you just created. But since the HOME directory is modified to your
      actualy home directory and the rpt contains this directory, you can
      observe that all your plugins will be loaded as usual. But if you try to
      get the help on any installed plugins, Vim says that the tag is not
      found. You can verify that the directory exists in the 'rtp'. If you add
      the directory again, then it seems to pick it up. Also, if you use the
      full path in the directory instead of "~", then also it seems to pick it
      up fine. This looks like a bug to me.

      Thank you,
      Hari

      __________________________________
      Do you Yahoo!?
      SBC Yahoo! DSL - Now only $29.95 per month!
      http://sbc.yahoo.com
    • Bram Moolenaar
      ... This is a bit complicated to reproduce. What is the value of ... Vim will search for doc/tags files in all directories in runtimepath . I can only
      Message 2 of 6 , Jul 1 1:22 PM
      • 0 Attachment
        Hari Krishna Dara wrote:

        > I am modifying 'rtp' from my .vimrc and I find that it is causing trouble
        > in finding help files. Though a particular directory exists in 'rtp',
        > the help files under the doc directory are not found by the :help
        > command (and yes, I did run :helpt, actually several times). I could
        > even narrow it down to the following code in the vimrc. To reproduce it,
        > please do the following:
        >
        > - Go to a temp directory, say /tmp/vim.
        > - Set HOME to the current directory. Setting it to "." should suffice.
        > - Create .vimrc file with the following as the contents:
        >
        > let $HOME='c:/hari'
        > let $VIMPACKAGE='~/package/vim'
        >
        > " Remove unnecessary paths as we know where to find the files.
        > set runtimepath-=~/vimfiles
        > set runtimepath-=~/vimfiles/after
        > set runtimepath-=~/.vim
        > set runtimepath-=~/.vim/after
        > set runtimepath-=$VIM/vimfiles
        > set runtimepath-=$VIM/vimfiles/after
        >
        > let &runtimepath = $VIMPACKAGE . ',' . &runtimepath
        >
        > - Adjust the HOME directory to your actual home directory and
        > VIMPACKAGE to the directory containing plugin, doc etc.
        > (~/vimfiles or ~/.vim, make sure you use ~ instead of the fullpath).
        > - Now start vim.
        >
        >
        > As the HOME directory is the current directory, it should pick the .vimrc
        > that you just created. But since the HOME directory is modified to your
        > actualy home directory and the rpt contains this directory, you can
        > observe that all your plugins will be loaded as usual. But if you try to
        > get the help on any installed plugins, Vim says that the tag is not
        > found. You can verify that the directory exists in the 'rtp'. If you add
        > the directory again, then it seems to pick it up. Also, if you use the
        > full path in the directory instead of "~", then also it seems to pick it
        > up fine. This looks like a bug to me.

        This is a bit complicated to reproduce. What is the value of
        'runtimepath' after all this? Use this command:

        :echo &runtimepath

        Vim will search for "doc/tags" files in all directories in
        'runtimepath'. I can only imagine the value of 'runtimepath' is wrong.

        Note that using a value for $HOME that is not an absolute path is very
        unusual, this might cause trouble anyway.

        --
        ARTHUR: (as the MAN next to him is squashed by a sheep) Knights! Run away!
        Midst echoing shouts of "run away" the KNIGHTS retreat to cover with the odd
        cow or goose hitting them still. The KNIGHTS crouch down under cover.
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
      • Hari Krishna Dara
        On Tue, 1 Jul 2003 at 10:22pm, Bram Moolenaar wrote: [snip] ... For the matter of fact, the actual case is more complicated than this, and I don t use a
        Message 3 of 6 , Jul 1 4:49 PM
        • 0 Attachment
          On Tue, 1 Jul 2003 at 10:22pm, Bram Moolenaar wrote:

          [snip]

          > >
          > >
          > > As the HOME directory is the current directory, it should pick the .vimrc
          > > that you just created. But since the HOME directory is modified to your
          > > actualy home directory and the rpt contains this directory, you can
          > > observe that all your plugins will be loaded as usual. But if you try to
          > > get the help on any installed plugins, Vim says that the tag is not
          > > found. You can verify that the directory exists in the 'rtp'. If you add
          > > the directory again, then it seems to pick it up. Also, if you use the
          > > full path in the directory instead of "~", then also it seems to pick it
          > > up fine. This looks like a bug to me.
          >
          > This is a bit complicated to reproduce. What is the value of
          > 'runtimepath' after all this? Use this command:
          >
          > :echo &runtimepath
          >
          > Vim will search for "doc/tags" files in all directories in
          > 'runtimepath'. I can only imagine the value of 'runtimepath' is wrong.
          >
          > Note that using a value for $HOME that is not an absolute path is very
          > unusual, this might cause trouble anyway.
          >

          For the matter of fact, the actual case is more complicated than this,
          and I don't use a relative path as the HOME path either. You can very
          well use /tmp/vim as the HOME path to start with.

          I tried the scenario again with "c:\tmp\vim" as the HOME diretory to start
          with and "c:\hari" as the new HOME directory (set from inside vimrc).
          The 'rtp' value after vim starts up:



          runtimepath=~/package/vim,c:\tmp\vim/vimfiles,c:/win32-gnu/vim,c:\tmp\vim/vimfiles/after


          And here is the output of :script command:


          1: c:\tmp\vim\.vimrc
          2: c:\hari\package\vim\plugin\PushPop.vim
          3: c:\hari\package\vim\plugin\breakpts.vim
          4: c:\hari\package\vim\plugin\chcmdmod.vim
          5: c:\hari\package\vim\plugin\genutils.vim
          6: c:\hari\package\vim\plugin\evolve.vim
          7: c:\hari\package\vim\plugin\execmap.vim
          8: c:\hari\package\vim\plugin\findInvokers.vim
          9: c:\hari\package\vim\plugin\foldutil.vim
          10: c:\hari\package\vim\plugin\idutils.vim
          11: c:\hari\package\vim\plugin\javautils.vim
          12: c:\hari\package\vim\plugin\multvals.vim
          13: c:\hari\package\vim\plugin\ntprocesses.vim
          14: c:\hari\package\vim\plugin\ntservices.vim
          15: c:\hari\package\vim\plugin\perforce.vim
          16: c:\hari\package\vim\plugin\remcmd.vim
          17: c:\hari\package\vim\plugin\selectbuf.vim
          18: c:\hari\package\vim\plugin\smartctrl-w.vim
          19: c:\hari\package\vim\plugin\undoins.vim
          20: c:\win32-gnu\vim\plugin\explorer.vim
          21: c:\win32-gnu\vim\plugin\gzip.vim
          22: c:\win32-gnu\vim\plugin\netrw.vim
          23: c:\win32-gnu\vim\plugin\rrhelper.vim
          24: c:\win32-gnu\vim\plugin\tohtml.vim


          And here is the output of dir on the doc director:


          c:\tmp\vim>dir c:\hari\package\vim\doc
          Volume in drive C has no label.
          Volume Serial Number is 70E6-DAB4

          Directory of c:\hari\package\vim\doc

          06/11/2003 01:48p <DIR> .
          06/11/2003 01:48p <DIR> ..
          06/11/2003 01:48p 78,205 perforce.txt
          04/10/2003 06:05p 30,675 selectbuf.txt
          05/23/2003 02:30p 11,322 tags
          3 File(s) 120,202 bytes
          2 Dir(s) 926,576,640 bytes free

          c:\tmp\vim>


          As you can see, all the components are valid and I have help files in
          the doc directory under the first rtp directory, but still, these files
          can't be found by vim. I reported this bug because I got intrigued by
          it. I have solved the issue by using the full path to represent the home
          directory, instead of using "~".

          Thanks,
          Hari

          __________________________________
          Do you Yahoo!?
          SBC Yahoo! DSL - Now only $29.95 per month!
          http://sbc.yahoo.com
        • Bram Moolenaar
          ... That matters, because :set runtimepath will shorten $HOME to ~ while :echo doesn t do that. If you did use :echo then the problem is that you have
          Message 4 of 6 , Jul 2 2:03 AM
          • 0 Attachment
            Hari Krishna Dara wrote:

            > > > As the HOME directory is the current directory, it should pick the
            > > > .vimrc that you just created. But since the HOME directory is
            > > > modified to your actualy home directory and the rpt contains this
            > > > directory, you can observe that all your plugins will be loaded as
            > > > usual. But if you try to get the help on any installed plugins,
            > > > Vim says that the tag is not found. You can verify that the
            > > > directory exists in the 'rtp'. If you add the directory again,
            > > > then it seems to pick it up. Also, if you use the full path in the
            > > > directory instead of "~", then also it seems to pick it up fine.
            > > > This looks like a bug to me.
            > >
            > > This is a bit complicated to reproduce. What is the value of
            > > 'runtimepath' after all this? Use this command:
            > >
            > > :echo &runtimepath
            > >
            > > Vim will search for "doc/tags" files in all directories in
            > > 'runtimepath'. I can only imagine the value of 'runtimepath' is wrong.
            > >
            > > Note that using a value for $HOME that is not an absolute path is very
            > > unusual, this might cause trouble anyway.
            > >
            >
            > For the matter of fact, the actual case is more complicated than this,
            > and I don't use a relative path as the HOME path either. You can very
            > well use /tmp/vim as the HOME path to start with.
            >
            > I tried the scenario again with "c:\tmp\vim" as the HOME diretory to start
            > with and "c:\hari" as the new HOME directory (set from inside vimrc).
            > The 'rtp' value after vim starts up:
            >
            > runtimepath=~/package/vim,c:\tmp\vim/vimfiles,c:/win32-gnu/vim,c:\tmp\vim/vimfiles/after

            Did you really use:

            :echo &runtimepath

            That matters, because ":set runtimepath" will shorten $HOME to "~" while
            ":echo" doesn't do that.

            If you did use ":echo" then the problem is that you have an unexpanded
            "~" in the option value, that won't work. If that is not the problem,
            then I can't see anything wrong. "~/package/vim" is where your
            "doc/tags" file is located, thus that _should_ work. But that "~/"
            really must be the full path.

            I still don't see what actually goes wrong, but it must have something
            to do with changing the value of $HOME while starting up. That means
            the value to which "~/" expands is not predictable.

            --
            Life would be so much easier if we could just look at the source code.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
          • Hari Krishna Dara
            ... runtimepath=~/package/vim,c: tmp vim/vimfiles,c:/win32-gnu/vim,c: tmp vim/vimfiles/after ... I didn t use :echo, I didn t know the difference. Using :echo
            Message 5 of 6 , Jul 2 12:48 PM
            • 0 Attachment
              On Wed, 2 Jul 2003 at 11:03am, Bram Moolenaar wrote:
              >
              > > >
              > > > This is a bit complicated to reproduce. What is the value of
              > > > 'runtimepath' after all this? Use this command:
              > > >
              > > > :echo &runtimepath
              > > >
              > > > Vim will search for "doc/tags" files in all directories in
              > > > 'runtimepath'. I can only imagine the value of 'runtimepath' is wrong.
              > > >
              > > > Note that using a value for $HOME that is not an absolute path is very
              > > > unusual, this might cause trouble anyway.
              > > >
              > >
              > > For the matter of fact, the actual case is more complicated than this,
              > > and I don't use a relative path as the HOME path either. You can very
              > > well use /tmp/vim as the HOME path to start with.
              > >
              > > I tried the scenario again with "c:\tmp\vim" as the HOME diretory to start
              > > with and "c:\hari" as the new HOME directory (set from inside vimrc).
              > > The 'rtp' value after vim starts up:
              > >
              > >
              runtimepath=~/package/vim,c:\tmp\vim/vimfiles,c:/win32-gnu/vim,c:\tmp\vim/vimfiles/after
              >
              > Did you really use:
              >
              > :echo &runtimepath
              >
              > That matters, because ":set runtimepath" will shorten $HOME to "~" while
              > ":echo" doesn't do that.

              I didn't use :echo, I didn't know the difference. Using :echo does show
              "~" for the path component that is causing the trouble.

              >
              > If you did use ":echo" then the problem is that you have an unexpanded
              > "~" in the option value, that won't work. If that is not the problem,
              > then I can't see anything wrong. "~/package/vim" is where your
              > "doc/tags" file is located, thus that _should_ work. But that "~/"
              > really must be the full path.

              Ok, that explains the problem. I looked into the doc about 'rtp' and
              didn't see anything mentioned about this. I think Vim is supposed to
              internally expand the "~" characters when they are used to :set 'rtp',
              but this is getting bypassed while doing the same using the :let
              command, which is what I am doing, so something like below will cause
              trouble:

              let dir='~/.vim'
              let &rtp = dir.','.&rtp

              This is either a bug that needs to be fixed or the doc needs to be
              updated.

              >
              > I still don't see what actually goes wrong, but it must have something
              > to do with changing the value of $HOME while starting up. That means
              > the value to which "~/" expands is not predictable.
              >

              In the real case, I am not changing the HOME directory from vimrc, but
              I did it here just to simplify it in this reproducible case. The problem
              can be reproduced even without changing the HOME value.

              Thank you,
              Hari

              __________________________________
              Do you Yahoo!?
              SBC Yahoo! DSL - Now only $29.95 per month!
              http://sbc.yahoo.com
            • Bram Moolenaar
              ... OK, that explains the problem then. ... I don t think the documentation states that a literal ~/ is supported in an option. There are only a few places
              Message 6 of 6 , Jul 2 1:39 PM
              • 0 Attachment
                Hari Krishna Dara wrote:

                > > Did you really use:
                > >
                > > :echo &runtimepath
                > >
                > > That matters, because ":set runtimepath" will shorten $HOME to "~" while
                > > ":echo" doesn't do that.
                >
                > I didn't use :echo, I didn't know the difference. Using :echo does show
                > "~" for the path component that is causing the trouble.

                OK, that explains the problem then.

                > > If you did use ":echo" then the problem is that you have an unexpanded
                > > "~" in the option value, that won't work. If that is not the problem,
                > > then I can't see anything wrong. "~/package/vim" is where your
                > > "doc/tags" file is located, thus that _should_ work. But that "~/"
                > > really must be the full path.
                >
                > Ok, that explains the problem. I looked into the doc about 'rtp' and
                > didn't see anything mentioned about this. I think Vim is supposed to
                > internally expand the "~" characters when they are used to :set 'rtp',
                > but this is getting bypassed while doing the same using the :let
                > command, which is what I am doing, so something like below will cause
                > trouble:
                >
                > let dir='~/.vim'
                > let &rtp = dir.','.&rtp
                >
                > This is either a bug that needs to be fixed or the doc needs to be
                > updated.

                I don't think the documentation states that a literal "~/" is supported
                in an option. There are only a few places where is mentioned that
                environment variables are expanded for the ":set" command.

                I'll add a remark anyway, since you got confused. But it won't help
                much, the text about option values is already so long that you wouldn't
                read all of it...

                --
                Experience is what you get when you don't get what you want.

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
              Your message has been successfully submitted and would be delivered to recipients shortly.