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

Re: Environment Variables for MacVim

Expand Messages
  • Peter Palmreuther
    ... Put these environment variables in file ${HOME}/.MacOSX/environment.plist This only works if the variables are static. Within this file no shell
    Message 1 of 4 , Jun 11, 2011
    • 0 Attachment
      On 06/11/2011 at 2:57pm Stephen Rasku wrote:
      > I have some customizations in my .vimrc that depend on environment variables to work.
      > If I call MacVim from the terminal these customizations work but if I launch it from the dock it doesn't.
      > I assume this is because my .bashrc is not sourced when launching from the dock but it is when
      > running from the terminal. Is there a way to ensure that the environment variables are set even
      > when MacVim is launched from the dock?

      Put these environment variables in file

      ${HOME}/.MacOSX/environment.plist

      This only works if the variables are static. Within this file no shell evaluations, and therefore no dynamic
      settings, are possible.

      To edit this file without a proper property file editor use on command line:

      plutil -convert xml1 ${HOME}/.MacOSX/environment.plist
      vim ${HOME}/.MacOSX/environment.plist
      # or mvim ${HOME}/.MacOSX/environment.plist
      # save
      plutil -convert binary1 ${HOME}/.MacOSX/environment.plist

      The syntax of this file is pretty simple:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
      <key>VARIABLE_NAME</key>
      <string>VARIABLE_VALUE</string>
      <key> VARIABLE_NAME </key>
      <string> VARIABLE_VALUE </string>
      ...
      </dict>
      </plist>

      "VARIABLE_NAME" and "VARIABLE_VALUE" of course have to be replaced with the actual variable name,
      respectively it's value.

      There's no quoting done for values containing space(s), i.e. no double quotes around the value, because in
      this XML structure spaces already are preserved.

      After a re-login the environment variables set this way should be effective. Me personally would remove them
      from any shell rc file (.profile, .bashrc, .zshrc, etc) for avoiding "misbehavior"; Otherwise one might edit just
      one place that sets these variables and forget about the other.

      A short note at last: these variables are as of then, of course, not set when MacVim (or any other program) is
      launched form Dock, but on login and inherited to the started program the normal way (i.e.: the parent makes
      the child process launched inherit it's environment settings).

      Hope that helps.

      Regards,

      Peter

      --
      You received this message from the "vim_mac" 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.