News for hackers. Stuff that matters.
Re:One with Vim by freakwit on Thursday January 27, 2011 @03:08PM (#2149244)
selfish question here: Does anybody know how to setup vim so that :! recognises aliases?

something like...

  set shellcmdflag=-O\ expand_aliases\ -c
Re:One with Vim by cgs1019 on Thursday January 27, 2011 @03:17PM (#2149275)
Your aliases are generally sourced from your shell rc file (ie ~/.bashrc). Not sure how vim launches the shell to run ex shell commands but in the interest of portability it's probably just sh with no rc files loaded. This is probably configurable. Try :help shell or :help :! (I'm not at a terminal so not sure what you'll find)
Re:One with Vim by graywh on Thursday January 27, 2011 @11:36PM (#2150818)
By default, Bash, Zsh, and other shells don't source the shell config when started with -c (because it's considered a non-interactive session). For Bash & Zsh, you can force .bashrc/.zshrc to load by adding -i to 'shellcmdflag'.
Re:One with Vim by Nick_C on Friday January 28, 2011 @01:11AM (#2150991)
I always start vim from within xterm (bashrc has already run and aliases are already set up). It just works. I can use :!ll (or ctrl-z and 'll' in the sub-shell) and it just works.

Not sure why it wouldn't for you.

Re:One with Vim by graywh on Friday January 28, 2011 @10:01AM (#2152024)
ctrl-z doesn't start a sub-shell, it backgrouns vim and returns you to the parent shell.

And maybe he's running gvim or from a login shell that hasn't sourced his bashrc.

Re:One with Vim by CamT on Thursday January 27, 2011 @04:02PM (#2149456)
I believe that vim sources env files rather than rc. For example, any aliases placed in my zshenv are available in vim but those in zshrc are not. I would imagine that applies to other shells as well.
Re:One with Vim by graywh on Thursday January 27, 2011 @11:37PM (#2150820)
Zsh always source zshenv, regardless of login/interactive options. AFAIK, Bash has no equivalent.