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

how to use string variable for "cs add" command

Expand Messages
  • Ni, Ruiyu
    Hi, How can I make the following command pass VIM check in _vimrc file? let CodeRoot = E:/code let CscopeDb = CodeRoot . /cscope.out cs add CscopeDb
    Message 1 of 9 , Jan 28, 2010
    • 0 Attachment

      Hi,

      How can I make the following command pass VIM check in _vimrc file?

       

      let CodeRoot = “E:/code”

      let CscopeDb = CodeRoot . “/cscope.out"

      cs add CscopeDb CodeRoot

       

       

      the problem is in line 3, cs add only accept direct string but not the variable. For example if I use the following cs add command VIM is fine.

      Cs add E:/code/cscope.out E:/code

       

      Thanks,

      Ray

       

      --
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • pansz
      ... what about ... ? -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
      Message 2 of 9 , Jan 28, 2010
      • 0 Attachment
        Ni, Ruiyu 写道:
        > Hi,
        > How can I make the following command pass VIM check in _vimrc file?
        >
        > let CodeRoot = "E:/code"
        > let CscopeDb = CodeRoot . "/cscope.out"
        > cs add CscopeDb CodeRoot
        >
        >
        > the problem is in line 3, cs add only accept direct string but not the variable. For example if I use the following cs add command VIM is fine.
        > Cs add E:/code/cscope.out E:/code
        >
        > Thanks,
        > Ray
        >

        what about

        :exe "cs add ".ScsopeDb." ".CodeRoot


        ?

        --
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
      • Ni, Ruiyu
        Thanks pansz! It works!! But I found ctags cannot work as well. let CodeRoot = E:/code let TagsDb = CodeRoot . /tags use exe set tags = . TagsDb or
        Message 3 of 9 , Jan 28, 2010
        • 0 Attachment
          Thanks pansz!
          It works!!

          But I found ctags cannot work as well.

          let CodeRoot = "E:/code"
          let TagsDb = CodeRoot . "/tags"

          use
          exe "set tags = " . TagsDb
          or
          set tags = TagsDb

          both cannot work. Do you have any idea? Thanks in advance!

          -----Original Message-----
          From: vim_use@... [mailto:vim_use@...] On Behalf Of pansz
          Sent: Friday, January 29, 2010 11:24 AM
          To: vim_use@...
          Subject: Re: how to use string variable for "cs add" command

          Ni, Ruiyu 写道:
          > Hi,
          > How can I make the following command pass VIM check in _vimrc file?
          >
          > let CodeRoot = "E:/code"
          > let CscopeDb = CodeRoot . "/cscope.out"
          > cs add CscopeDb CodeRoot
          >
          >
          > the problem is in line 3, cs add only accept direct string but not the variable. For example if I use the following cs add command VIM is fine.
          > Cs add E:/code/cscope.out E:/code
          >
          > Thanks,
          > Ray
          >

          what about

          :exe "cs add ".ScsopeDb." ".CodeRoot


          ?

          --
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php

          --
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
        • Benjamin R. Haskell
          ... The syntax for set parameters is stricter than the syntax for let assignments. If you omit the spaces around the = , the exe version should work:
          Message 4 of 9 , Jan 28, 2010
          • 0 Attachment
            On Fri, 29 Jan 2010, Ni, Ruiyu wrote:

            > Thanks pansz!
            > It works!!
            >
            > But I found ctags cannot work as well.
            >
            > let CodeRoot = "E:/code"
            > let TagsDb = CodeRoot . "/tags"
            >
            > use
            > exe "set tags = " . TagsDb
            > or
            > set tags = TagsDb
            >
            > both cannot work. Do you have any idea? Thanks in advance!

            The syntax for 'set' parameters is stricter than the syntax for 'let'
            assignments. If you omit the spaces around the '=', the 'exe' version
            should work:

            exe "set tags=" . TagsDb

            --
            Best,
            Ben

            --
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
          • sc
            ... from ... i see White space between = and {value} is not allowed. -- so you should probably try exe set tags= . TagsDb sc -- You received this message
            Message 5 of 9 , Jan 28, 2010
            • 0 Attachment
              On Thursday 28 January 2010 09:31:07 pm Ni, Ruiyu wrote:

              > Thanks pansz!
              > It works!!
              >
              > But I found ctags cannot work as well.
              >
              > let CodeRoot = "E:/code"
              > let TagsDb = CodeRoot . "/tags"
              >
              > use
              > exe "set tags = " . TagsDb
              > or
              > set tags = TagsDb
              >
              > both cannot work. Do you have any idea? Thanks in advance!

              from

              :help set

              i see "White space between '=' and {value} is not allowed." -- so
              you should probably try

              exe "set tags=" . TagsDb

              sc

              --
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
            • Ni, Ruiyu
              Thank you sc & pansz! Both works now!! ... From: vim_use@googlegroups.com [mailto:vim_use@googlegroups.com] On Behalf Of sc Sent: Friday, January 29, 2010
              Message 6 of 9 , Jan 29, 2010
              • 0 Attachment
                Thank you sc & pansz! Both works now!!

                -----Original Message-----
                From: vim_use@... [mailto:vim_use@...] On Behalf Of sc
                Sent: Friday, January 29, 2010 12:53 PM
                To: vim_use@...
                Subject: Re: how to use string variable for "cs add" command

                On Thursday 28 January 2010 09:31:07 pm Ni, Ruiyu wrote:

                > Thanks pansz!
                > It works!!
                >
                > But I found ctags cannot work as well.
                >
                > let CodeRoot = "E:/code"
                > let TagsDb = CodeRoot . "/tags"
                >
                > use
                > exe "set tags = " . TagsDb
                > or
                > set tags = TagsDb
                >
                > both cannot work. Do you have any idea? Thanks in advance!

                from

                :help set

                i see "White space between '=' and {value} is not allowed." -- so
                you should probably try

                exe "set tags=" . TagsDb

                sc

                --
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php

                --
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
              • Gary Johnson
                ... Or you could use let: let &tags = TagsDb See ... Regards, Gary -- You received this message from the vim_use maillist. For more information, visit
                Message 7 of 9 , Jan 29, 2010
                • 0 Attachment
                  On 2010-01-28, sc wrote:
                  > On Thursday 28 January 2010 09:31:07 pm Ni, Ruiyu wrote:
                  >
                  > > Thanks pansz!
                  > > It works!!
                  > >
                  > > But I found ctags cannot work as well.
                  > >
                  > > let CodeRoot = "E:/code"
                  > > let TagsDb = CodeRoot . "/tags"
                  > >
                  > > use
                  > > exe "set tags = " . TagsDb
                  > > or
                  > > set tags = TagsDb
                  > >
                  > > both cannot work. Do you have any idea? Thanks in advance!
                  >
                  > from
                  >
                  > :help set
                  >
                  > i see "White space between '=' and {value} is not allowed." -- so
                  > you should probably try
                  >
                  > exe "set tags=" . TagsDb

                  Or you could use let:

                  let &tags = TagsDb

                  See

                  :help let-&

                  Regards,
                  Gary


                  --
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                • Tony Mechelynck
                  ... and since :exe[cute] accepts any number of arguments (and concatenates them space-separated), ... would work just as well. -- You received this message
                  Message 8 of 9 , Feb 1, 2010
                  • 0 Attachment
                    On 29/01/10 04:23, pansz wrote:
                    > Ni, Ruiyu 写道:
                    >> Hi,
                    >> How can I make the following command pass VIM check in _vimrc file?
                    >>
                    >> let CodeRoot = "E:/code"
                    >> let CscopeDb = CodeRoot . "/cscope.out"
                    >> cs add CscopeDb CodeRoot
                    >>
                    >>
                    >> the problem is in line 3, cs add only accept direct string but not the
                    >> variable. For example if I use the following cs add command VIM is fine.
                    >> Cs add E:/code/cscope.out E:/code
                    >>
                    >> Thanks,
                    >> Ray
                    >>
                    >
                    > what about
                    >
                    > :exe "cs add ".ScsopeDb." ".CodeRoot
                    >
                    >
                    > ?
                    >

                    and since ":exe[cute]" accepts any number of arguments (and concatenates
                    them space-separated),

                    :exe 'cs add' CscopeDB CodeRoot

                    would work just as well.

                    --
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                  • pansz
                    ... Nice hint! -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
                    Message 9 of 9 , Feb 3, 2010
                    • 0 Attachment
                      > and since ":exe[cute]" accepts any number of arguments (and concatenates
                      > them space-separated),
                      >
                      > :exe 'cs add' CscopeDB CodeRoot
                      >
                      > would work just as well.
                      >

                      Nice hint!

                      --
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                    Your message has been successfully submitted and would be delivered to recipients shortly.