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

how to make a file relative to $VIM

Expand Messages
  • Jeri Raye
    Hi, I can make a directory relative to $VIM with this command set bdir=$VIM/vimfiles/backup I can make a file location with an absolute path available bij
    Message 1 of 8 , Feb 1, 2013
    • 0 Attachment
      Hi,

      I can make a directory relative to $VIM with this command
      set bdir=$VIM/vimfiles/backup

      I can make a file location with an absolute path available bij saying:
      let MRU_File = 'C:\vim\_vim_mru_files'

      How can I make a file location relative to $VIM?
      let MRU_File = "$VIM/_vim_mru_files"'doesn't seem to work

      Rgds,
      Jeri

      --
      --
      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.
    • Christian Brabandt
      Hi Jeri! ... You need to expand the environment variables using expand() regards, Christian -- Ich will nichts mit den Nieren wagen solang daran die Viren
      Message 2 of 8 , Feb 1, 2013
      • 0 Attachment
        Hi Jeri!

        On Fr, 01 Feb 2013, Jeri Raye wrote:

        > Hi,
        >
        > I can make a directory relative to $VIM with this command
        > set bdir=$VIM/vimfiles/backup
        >
        > I can make a file location with an absolute path available bij saying:
        > let MRU_File = 'C:\vim\_vim_mru_files'
        >
        > How can I make a file location relative to $VIM?
        > let MRU_File = "$VIM/_vim_mru_files"'doesn't seem to work

        You need to expand the environment variables using expand()

        regards,
        Christian
        --
        Ich will nichts mit den Nieren wagen
        solang' daran die Viren nagen.

        --
        --
        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.
      • Jeri Raye
        ... [...] ... [...] When I type : let MRU_File = expand($VIM)/_vim_mru_files a) it creates errors E121: Undefined variable: _vim_mru_files E15: Invalid
        Message 3 of 8 , Feb 1, 2013
        • 0 Attachment
          On Fri, Feb 1, 2013 at 9:59 AM, Christian Brabandt <cblists@...> wrote:
          > Hi Jeri!
          >
          [...]
          > You need to expand the environment variables using expand()
          [...]

          When I type :

          let MRU_File = expand($VIM)/_vim_mru_files

          a) it creates errors
          E121: Undefined variable: _vim_mru_files
          E15: Invalid expression: expand($VIM)/_vim_mru_files

          b) However it does seems to work.

          What is wrong?


          When I added two qoutes characters (') before and behind the line:
          let MRU_File = 'expand($VIM)/_vim_mru_files'
          I don't get the error, but it also doesn't work.

          Rgds,
          Jeri

          --
          --
          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.
        • Jeri Raye
          Hi, [...] ... [...] let MRU_File = expand( $VIM ) /_vim_mru_files solves E121. But E15 stil remains. I think I have to concatenate the two strings, but I
          Message 4 of 8 , Feb 1, 2013
          • 0 Attachment
            Hi,
            [...]
            > E121: Undefined variable: _vim_mru_files
            > E15: Invalid expression: expand($VIM)/_vim_mru_files
            [...]

            let MRU_File = expand('$VIM')'/_vim_mru_files'
            solves E121.
            But E15 stil remains.

            I think I have to concatenate the two strings, but I don't know how to
            do that in vim

            Rgds,
            Jeri

            --
            --
            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.
          • Christian Brabandt
            ... regards, Christian -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For
            Message 5 of 8 , Feb 1, 2013
            • 0 Attachment
              On Fri, February 1, 2013 10:34, Jeri Raye wrote:
              > On Fri, Feb 1, 2013 at 9:59 AM, Christian Brabandt <cblists@...>
              > wrote:
              >> Hi Jeri!
              >>
              > [...]
              >> You need to expand the environment variables using expand()
              > [...]
              >
              > When I type :
              >
              > let MRU_File = expand($VIM)/_vim_mru_files
              >
              > a) it creates errors
              > E121: Undefined variable: _vim_mru_files
              > E15: Invalid expression: expand($VIM)/_vim_mru_files

              :let expects and an expression and so you need to quote strings and
              append them:
              :let MRU_File = expand($VIM). "/_vim_mru_files"

              alternatively, you can use:
              :let my_path = "$VIM/_vim_mru_files"
              :let MRU_FILE = expand(my_path)


              regards,
              Christian

              --
              --
              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.
            • Jürgen Krämer
              Hi, ... you don t need expand() here. It s onyl necessary if you want to expand environment variables inside a string, like in the second example. Thus, ... is
              Message 6 of 8 , Feb 1, 2013
              • 0 Attachment
                Hi,

                Christian Brabandt wrote:
                > On Fri, February 1, 2013 10:34, Jeri Raye wrote:
                >> On Fri, Feb 1, 2013 at 9:59 AM, Christian Brabandt <cblists@...>
                >> wrote:
                >>> Hi Jeri!
                >>>
                >> [...]
                >>> You need to expand the environment variables using expand()
                >> [...]
                >>
                >> When I type :
                >>
                >> let MRU_File = expand($VIM)/_vim_mru_files
                >>
                >> a) it creates errors
                >> E121: Undefined variable: _vim_mru_files
                >> E15: Invalid expression: expand($VIM)/_vim_mru_files
                >
                > :let expects and an expression and so you need to quote strings and
                > append them:
                > :let MRU_File = expand($VIM). "/_vim_mru_files"

                you don't need expand() here. It's onyl necessary if you want to expand
                environment variables inside a string, like in the second example. Thus,

                :let MRU_File = $VIM . "/_vim_mru_files"

                is sufficient.

                > alternatively, you can use:
                > :let my_path = "$VIM/_vim_mru_files"
                > :let MRU_FILE = expand(my_path)

                Regards,
                Jürgen

                --
                Sometimes I think the surest sign that intelligent life exists elsewhere
                in the universe is that none of it has tried to contact us. (Calvin)

                --
                --
                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.
              • Jeri Raye
                ... Christian Thanks. It works. Rgds, Jeri -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are
                Message 7 of 8 , Feb 1, 2013
                • 0 Attachment
                  > :let expects and an expression and so you need to quote strings and
                  > append them:
                  > :let MRU_File = expand($VIM). "/_vim_mru_files"
                  >
                  > alternatively, you can use:
                  > :let my_path = "$VIM/_vim_mru_files"
                  > :let MRU_FILE = expand(my_path)
                  >
                  >
                  > regards,
                  > Christian

                  Christian
                  Thanks.
                  It works.

                  Rgds,
                  Jeri

                  --
                  --
                  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.
                • Christian Brabandt
                  ... Oh, I learnt something new today. I didn t know, you can use environment variables like normal variables. regards, Christian -- -- You received this
                  Message 8 of 8 , Feb 1, 2013
                  • 0 Attachment
                    On Fri, February 1, 2013 10:59, Jürgen Krämer wrote:
                    > Christian Brabandt wrote:
                    >> :let expects and an expression and so you need to quote strings and
                    >> append them:
                    >> :let MRU_File = expand($VIM). "/_vim_mru_files"
                    >
                    > you don't need expand() here. It's onyl necessary if you want to expand
                    > environment variables inside a string, like in the second example. Thus,
                    >
                    > :let MRU_File = $VIM . "/_vim_mru_files"
                    >
                    > is sufficient.

                    Oh, I learnt something new today. I didn't know, you can use environment
                    variables like normal variables.

                    regards,
                    Christian

                    --
                    --
                    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.