Because Ubuntu provides no up-to-date packages for TeXLive, I installed it manually. However, some programs need TeXLive as dependency. So what I did is I installed the TeXLive package from the Ubuntu repositories on top of that, which is the 2009 version. I then changed my $PATH to contain the manually installed 2011 version, so programs still always point to and use the most recent TeXLive version. So far this worked fine.

But here is the snap: When I switched to VIM for editing my LaTeX files, I noticed after a too much of a headache that VIM "sees" only TeXLive2009! See this screenshot, left is VIM, right a terminal:

LaTeX Version in VIM

I then checked what $PATH VIM is using, and as it turns out, it is using a different one, that does NOT point to TeXLive 2011. See this screenshot:

Path in VIM and Terminal


:! echo $PATH


echo $PATH

Do you have any idea how to fix this, so my LaTeX plugins can use TeXLive 2011, maybe by making VIM use the same $PATH? Any help would be GREATLY appreciated!

  • 4
    Where do you changed your PATH? – enzotib Oct 30 '11 at 19:57

It looks like you've changed the $PATH variable in one of your shell configuration files, but you start VIM from an icon or desktop menu entry. The things you set in shell configuration files (like ~/.bashrc or /etc/profile) affect only the applications started from shell.

There are generally two three possible approaches to this problem:

  • local: Change the way VIM is started.


  • per-user: Modify your user's environment in ~/.profile.


  • global: Modify the global environment.

The local solution is the safest (as it affects only one program), but since you've already messed up the system by installing two concurrent versions of a software package, I'm not sure if this will scare you. Anyway, you can do that by modifying the .desktop entry for VIM in your Desktop Environment and change the associated command from something like gnome-terminal -c vim to PATH=(yourPathGoesHere) gnome-terminal -c vim.

The global method is to modify the PATH variable in a file under /etc/env.d/. It should be enough to create a file /etc/env.d/99-my_path_mod, containing PATH=(yourPathGoesHere):$PATH. You'll need to reboot for this to take effect (Well, reboot could be avoided by switching init level back and forth, but it's far easier that way.)


Per-user solution might be the best and, as I see it now, can be called "the proper way". As pointed out by Gilles (below), the ~/.profile file is where environment variables for all your login sessions should be set.

  • Thanks, following your solution the easiest probably is to just call gvim from a terminal. That works fine! – Ingo Oct 30 '11 at 21:32
  • This answer is misleading and partially incorrect. There is no need to change anything at the system level; instead, @Ingo, the simple solution is to set environment variables in ~/.profile and never in ~/.bashrc. Doing thing properly is not difficult and will prevent future problems. – Gilles 'SO- stop being evil' Oct 31 '11 at 21:02
  • @Gilles I admit I did not realize the main role of ~/.profile, so my answer can be misleading. But in what part is it incorrect? – rozcietrzewiacz Oct 31 '11 at 21:37
  • Ok, technically I think the only incorrect thing is “generally two possible approaches”: there's a third approach that's common and preferable. Presenting /etc/profile as a shell configuration file is technically true but misleading (it's a config file written in shell, not a config file of the shell). Not mentioning ~/.profile is a major omission, which alone makes your answer “not useful”. – Gilles 'SO- stop being evil' Oct 31 '11 at 21:58
  • As I open my /etc/profile, this is what I see at the very top of it. So, at least on my system (Gentoo), the file can be called "config file of the shell". – rozcietrzewiacz Oct 31 '11 at 22:05

Where did you change your user's PATH? Normally, I would set that in ~/.profile, where it should be picked up by your X session manager (i.e. on the next X login) and also apply to all applications in your X session (such as your panel/desktop where you start gvim from).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.