Environment Variables for MacVim

2011-06-11 Thread Stephen Rasku
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?

...Stephen

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


Re: Environment Variables for MacVim

2011-06-11 Thread Ben Schmidt

On 11/06/11 10:57 PM, 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?


Hi, Stephen,

Sounds like you have things in your .bashrc (for interactive non-login
shells--or, for some insane reason I have yet to understand,
non-interactive non-login shells when invoked by ssh) that you want in
.profile (for login shells). MacVim, like Terminal, launches a login
shell when it starts Vim instances. But for MacVim it is not an
interactive shell.

Ben.


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


Re: Environment Variables for MacVim

2011-06-11 Thread Billy Huang
are you launching mvim or vi in terminal?

if is mvim, than in the menu, click on 'edit; than select startup settings,
see if you that is using the same .vimrc file,

however, what is used in macvim gui should act the same to vi terminal, only
some of the color schemes don't work under both.



On Sat, Jun 11, 2011 at 11:07 PM, Ben Schmidt mail_ben_schm...@yahoo.com.au
 wrote:

 On 11/06/11 10:57 PM, 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?


 Hi, Stephen,

 Sounds like you have things in your .bashrc (for interactive non-login
 shells--or, for some insane reason I have yet to understand,
 non-interactive non-login shells when invoked by ssh) that you want in
 .profile (for login shells). MacVim, like Terminal, launches a login
 shell when it starts Vim instances. But for MacVim it is not an
 interactive shell.

 Ben.



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


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


Re: Environment Variables for MacVim

2011-06-11 Thread Peter Palmreuther
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
keyVARIABLE_NAME/key
stringVARIABLE_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