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

Re: Accessing Environmnetal Variable from a vim script

Expand Messages
  • Antoine J. Mechelynck
    ... Almost as you did. There are minor syntax differences (see :help eval ). So the following will work as a starting point: if $PLATFORM == sun4os5 echomsg
    Message 1 of 3 , Feb 27, 2005
      R. shankar wrote:
      > How do I access an environmental variable from a vim script ?
      >
      > Lets us assume that PLATFORM is an environment variable which can hold two values sun4os5 or linux.
      > I want to have the script as given below -
      >
      > if $PLATFORM = sun4os5
      > let cmd = .....
      > else
      > let cmd = .......
      > end if
      >
      > How can I do this ?
      >
      > Regards,
      > shankar
      >
      >
      >
      >
      >
      Almost as you did. There are minor syntax differences (see ":help
      eval"). So the following will work as a starting point:


      if $PLATFORM == "sun4os5"
      echomsg "sun4os5"
      elseif $PLATFORM == "linux"
      echomsg "linux"
      else
      echoerr "unknown platform <" . $PLATFORM . ">"
      endif

      HTH,
      Tony.
    Your message has been successfully submitted and would be delivered to recipients shortly.