gvim - environment/bashrc not loaded

0 views
Skip to first unread message

Aljosa Mohorovic

unread,
Nov 19, 2008, 7:57:10 AM11/19/08
to vim_use
i have some paths and other stuff defined in bashrc and when i start
vim from command line everything works but when i use gvim it seems
like stuff i defined in bashrc are not loaded.
any idea what's wrong?

Aljosa

Ben Schmidt

unread,
Nov 19, 2008, 8:16:06 AM11/19/08
to vim...@googlegroups.com

What operating system? What window manager? Etc.

How are you starting gvim?

Does logging out and back in (or restarting) help?

Vim inherits its environment from whatever started it. If you start it
from your desktop, where does your desktop get its environment from?
Whatever started that. Quite possibly your login shell. But its stuff
got set when you logged in, so it won't take effect until you log out
and in again.

If you provide more specifics though, someone can probably give you more
specific assistance (probably not me as I'm on a Mac, so it's quite
different!).

Ben.

Tony Mechelynck

unread,
Nov 19, 2008, 10:49:15 AM11/19/08
to vim...@googlegroups.com

On Linux, your desktop gets its environment from the window manager you
selected (or defaulted) at (graphical) login time, totally bypassing
bash. I'm not sure where the winmanager inherits its environment from --
probably from init I think. Depending on which winmanager you are using,
it may or may not be possible to configure it to set some user-defined
settings at login time (I use kdm and I haven't found any place to set
such settings).

To set some particular settings just for Vim, you can always set them in
your vimrc, of course.


Best regards,
Tony.
--
Military justice is to justice what military music is to music.
-- Groucho Marx

Gary Johnson

unread,
Nov 19, 2008, 11:21:33 AM11/19/08
to vim...@googlegroups.com

Your bashrc is read by bash when it starts in interactive mode, so
it was read by the instance of bash running in your terminal. If
you launched gvim from the command line, it would see the same
environment that your vim sees.

You are probably launching gvim from your window manager, which gets
its environment from a number of places, but not from your bashrc
since your window manager was not run from bash.

Stuff like PATH and other environment settings that you expect to be
seen by applications launched from your window manager should really
be defined in your ~/.profile instead of in your ~/.bashrc. Your
~/.profile is read when you log in, whether through X or through a
terminal. Environment settings (but not aliases) made there and
exported will be seen by all your processes. Your ~/.bashrc should
really be used to make only those settings that you expect to use
only from the command line (including aliases and functions) or by
applications launched only from the command line.

HTH,
Gary

Aljosa Mohorovic

unread,
Nov 20, 2008, 10:20:45 AM11/20/08
to vim_use
thanks, it's all working after i moved stuff from bashrc to profile.

Aljosa
Reply all
Reply to author
Forward
0 new messages