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

Re: string type in vim script language

Expand Messages
  • Israel Chauca F.
    ... If you want to append the extension, the last one should be let filename = filename . .cpp Israel -- You received this message from the vim_use
    Message 1 of 7 , Feb 1, 2011
    • 0 Attachment
      On Feb 1, 2011, at 7:15 AM, Ben Schmidt wrote:

      >> However, I get the following
      >>
      >> Error detected while processing function SwitchSourceHeader:
      >> line 5:
      >> E492 Not an editor command: filename = expand(%:t:r)
      >>
      >> I am wondering if anyone can point out a correct way for doing this.
      >
      > In vimscript, 'let' isn't just used to declare variables the first time
      > they are used, it is used any time you want to change a variable value.
      > So you need
      >
      > let filename = expand(%:t:r)
      > let filename = filename + ".cpp"

      If you want to append the extension, the last one should be

      let filename = filename . '.cpp'

      Israel

      --
      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
    • shuda Li
      Thank you every one! Briefly conclude: let filename = expand( %:t:r ). .cpp Shuda On Tue, Feb 1, 2011 at 1:47 PM, Israel Chauca F. ... -- Shuda Li ... PhD 
      Message 2 of 7 , Feb 1, 2011
      • 0 Attachment
        Thank you every one!

        Briefly conclude:

        let filename = expand("%:t:r").'.cpp'

        Shuda


        On Tue, Feb 1, 2011 at 1:47 PM, Israel Chauca F.
        <israelvarios@...> wrote:
        >
        > On Feb 1, 2011, at 7:15 AM, Ben Schmidt wrote:
        >
        >>> However, I get the following
        >>>
        >>> Error detected while processing function SwitchSourceHeader:
        >>> line 5:
        >>> E492 Not an editor command: filename = expand(%:t:r)
        >>>
        >>> I am wondering if anyone can point out a correct way for doing this.
        >>
        >> In vimscript, 'let' isn't just used to declare variables the first time
        >> they are used, it is used any time you want to change a variable value.
        >> So you need
        >>
        >> let filename = expand(%:t:r)
        >> let filename = filename + ".cpp"
        >
        > If you want to append the extension, the last one should be
        >
        > let filename = filename . '.cpp'
        >
        > Israel
        >



        --
        Shuda Li
        --------------------------------
        PhD  Candidate
        Computer Vision Group
        Room 1.15
        Merchant Venturers Building
        Woodland Road
        the University of Bristol
        Bristol BS8 1UB
        United Kingdom
        ---------------------------------
        Email:  csxsl@...
                    csxsl@...
        web:    http://www.cs.bris.ac.uk/~csxsl/
        Office:    +44 (0)117 954 5629
        Fax:       +44 (0)117 954 5208
        ---------------------------------

        --
        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
      • Luc Hermitte
        Hello, ... Hmm.. Did you see the Alternate plugin (#31) ? And IIRC, there exist another plugin that does the same job. -- Luc Hermitte
        Message 3 of 7 , Feb 1, 2011
        • 0 Attachment
          Hello,

          "shuda Li" wrote:

          > Thank you every one!
          >
          > Briefly conclude:
          >
          > let filename = expand("%:t:r").'.cpp'

          Hmm.. Did you see the Alternate plugin (#31) ? And IIRC, there exist another plugin that does the same job.

          --
          Luc Hermitte
          http://lh-vim.googlecode.com/
          http://hermitte.free.fr/vim/

          --
          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
        • Michael Henry
          ... As an alternative :-) I use and enjoy Derek Wyatt s FSwitch plugin for this purpose: http://www.vim.org/scripts/script.php?script_id=2590 Michael Henry
          Message 4 of 7 , Feb 1, 2011
          • 0 Attachment
            On 02/01/2011 09:29 AM, Luc Hermitte wrote:
            > "shuda Li" wrote:
            >> let filename = expand("%:t:r").'.cpp'
            >
            > Hmm.. Did you see the Alternate plugin (#31) ? And IIRC, there
            > exist another plugin that does the same job.

            As an "alternative" :-) I use and enjoy Derek Wyatt's FSwitch
            plugin for this purpose:
            http://www.vim.org/scripts/script.php?script_id=2590

            Michael Henry

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