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

Question about environment variables in vimscript

Expand Messages
  • H Xu
    Hello everybody, In vimscript, it is possible to modify the environment variables. My question is, how to execute a sh or batch file inside vimscript and the
    Message 1 of 4 , Oct 1, 2010
    • 0 Attachment
      Hello everybody,

      In vimscript, it is possible to modify the environment variables. My
      question
      is, how to execute a sh or batch file inside vimscript and the the
      changes of
      environment variables made by them take effect?

      Thanks.

      Regards,
      Hong Xu
      2010/10/2

      --
      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
    • Tom Link
      ... 1 I d say you can set environment variables but this affects only processes started by vim since the values of environment variables are usually inherited
      Message 2 of 4 , Oct 1, 2010
      • 0 Attachment
        > In vimscript, it is possible to modify the environment variables.

        :let $foo = 1
        :! echo $foo
        1

        I'd say you can set environment variables but this affects only
        processes started by vim since the values of environment variables are
        usually inherited from the caller.

        Since Windows could be slightly different you might need to specify
        more precisely which OS you use and what you're trying to achieve.

        Regards,
        Tom

        --
        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
      • ZyX
        Ответ на сообщение «Question about environment variables in vimscript», присланное в 21:53:36 01 октября 2010,
        Message 3 of 4 , Oct 1, 2010
        • 0 Attachment
          Ответ на сообщение «Question about environment variables in vimscript»,
          присланное в 21:53:36 01 октября 2010, Пятница.
          Отправитель: H Xu:

          You can modify enviroment variables from vimscript using
          let $VARIABLE="value"
          . You cannot export enviroment enviroment changes made by child process into
          parent process neither in vimscript nor in other language: it is kernel level
          restriction. If you see that something like
          function SetVar() {
          A="test"
          }
          A="test0"
          echo $A
          SetVar
          echo $A
          echoes `test0' and then `test' it only means that `SetVar' function is executed
          inside the same shell process. Parsing text that script outputs to stdout is the
          only way to modify vim enviroment.

          Текст сообщения:
          > Hello everybody,
          >
          > In vimscript, it is possible to modify the environment variables. My
          > question
          > is, how to execute a sh or batch file inside vimscript and the the
          > changes of
          > environment variables made by them take effect?
          >
          > Thanks.
          >
          > Regards,
          > Hong Xu
          > 2010/10/2
        • H Xu
          ... Hi ZyX: I have understood. Thank you very much. H Xu 2010/10/2 -- You received this message from the vim_use maillist. Do not top-post! Type your reply
          Message 4 of 4 , Oct 1, 2010
          • 0 Attachment
            On 2010/10/2 2:31, ZyX wrote:
            > Ответ на сообщение <<Question about environment variables in vimscript>>,
            > присланное в 21:53:36 01 октября 2010, Пятница.
            > Отправитель: H Xu:
            >
            > You can modify enviroment variables from vimscript using
            > let $VARIABLE="value"
            > . You cannot export enviroment enviroment changes made by child process into
            > parent process neither in vimscript nor in other language: it is kernel level
            > restriction. If you see that something like
            > function SetVar() {
            > A="test"
            > }
            > A="test0"
            > echo $A
            > SetVar
            > echo $A
            > echoes `test0' and then `test' it only means that `SetVar' function is executed
            > inside the same shell process. Parsing text that script outputs to stdout is the
            > only way to modify vim enviroment.
            >
            > Текст сообщения:
            >> Hello everybody,
            >>
            >> In vimscript, it is possible to modify the environment variables. My
            >> question
            >> is, how to execute a sh or batch file inside vimscript and the the
            >> changes of
            >> environment variables made by them take effect?
            >>
            >> Thanks.
            >>
            >> Regards,
            >> Hong Xu
            >> 2010/10/2

            Hi ZyX:

            I have understood. Thank you very much.

            H Xu
            2010/10/2

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