Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I map a command in vim using something like

map <f4> :! pdflatex %<cr>

Vim will ignore my alias for pdflatex (something like alias pdflatex='pdflatex --temp-dir=something'). Is it possible to make vim not ignore it?

share|improve this question
Is it possible your vim shell or shelltype don't match your login shell? – DaveParillo Sep 30 '09 at 16:18
up vote 15 down vote accepted

Vim 'ignores' your aliases because your shell is not in a 'mood' to parse your .bash_profile/.bashrc (you did not specify, where your aliases are defined) because it is not started as a login/interactive shell (read here to find out more about what is read when and for what reason).

So, you have several options:

  1. Put the code you use in your pdflatex alias into a script and call that
  2. vimrc: 'set shell=/bin/bash\ -l', put your aliases to .bash_profile
  3. Call your shell as an interactive/login shell: :! bash -l -i -e 'pdflatex .'
share|improve this answer
Login/non-login doesn't matter for ~/.bashrc - only interactive/non-interactive does. – grawity Sep 28 '09 at 11:44
my aliases are in .bash_profile.. hmm I changed the question a little. I'd rather it run in the current shell. Your second solution seemed the most 'acceptable' however, it makes the % variable useless since opening a new shell usually starts at the home folder. – vonhogen Sep 29 '09 at 7:12
This is an amazing and thorough answer. Thanks! – Abel Mar 30 '11 at 21:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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