up vote 7 down vote favorite
2
share [g+] share [fb]

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?

link|improve this question

73% accept rate
Is it possible your vim shell or shelltype don't match your login shell? – DaveParillo Sep 30 '09 at 16:18
feedback

1 Answer

up vote 9 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 .'
link|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 Martin Mar 30 '11 at 21:52
feedback

Your Answer

 
or
required, but never shown

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