JaredVogt / vimrc

CONFIG: my vimrc
0 stars 0 forks source link

source .bash_profile when using :! (and why isn't it picking up aliases) #36

Open JaredVogt opened 8 years ago

JaredVogt commented 8 years ago

set shell=bash\ --login - this will source .bash_profile. BUT, it is erroring out...

/Users/jaredvogt/.config/myBashProfile: line 61: bind: warning: line editing not enabled
/Users/jaredvogt/.config/myBashProfile: line 63: bind: warning: line editing not enabled
/Users/jaredvogt/.config/scripts/acd_func.sh: line 64: bind: warning: line editing not enabled
Now using node v6.1.0
bash: lla: command not found

shell returned 127 
JaredVogt commented 8 years ago

set shell=/usr/local/bin/bash - well, a clue. My login shell is NOT the right one - that is the OSX shell, but I am using a brew installed shell. Why? Well, to update the env SHELL=/bin/bash requires booting into Recovery Mode and turning off System Integrity Protection.

https://www.macbartender.com/system-item-setup/

So, more steps...

JaredVogt commented 8 years ago

Added the following chunk (from http://stackoverflow.com/questions/8841116/vim-not-recognizing-aliases-when-in-interactive-mode)

" ------------------------------------------------------------------------------
" shell Section
" ------------------------------------------------------------------------------
set shell=/usr/local/bin/bash\ --rcfile\ ~/.bash_profile
let $BASH_ENV = "~/.config/MyAliases"

This is working! At least it is accessing the aliases that are being explicitly pointed to. There is more thinking to do here - prob should move MyAliases to a dif location.

In particular, followed these instructions

If you want non-interactive shell (as default) but expansion of bash aliases, put your alias definitions in a file, e.g. .bash_aliases and explicitly enable alias expansion in this file:

shopt -s expand_aliases
alias la='ls -la'

Then add this to your .vimrc so the aliases file is actually read each time you run a shell command from within vim:

let $BASH_ENV = "~/.bash_aliases"