oh-my-fish / plugin-foreign-env

Run foreign bash scripts and capture exported environment variables
MIT License
221 stars 15 forks source link

Is this normal? #2

Closed krzkrzkrz closed 9 years ago

krzkrzkrz commented 9 years ago

As requested.

So in ~/.config/omf/init.fish, I have:

fenv source ~/.vim/bundle/gruvbox/gruvbox_256palette.sh

Everytime I start a Fish shell, I see:

---DIVIDER--- MANPATH=/Users/chris/.nvm/versions/node/v0.12.2/share/man:/Users/chris/.rvm/rubies/ruby-2.1.6/share/man:/usr/local/share/man:/usr/share/man:/Users/chris/.rvm/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man NVM_IOJS_ORG_VERSION_LISTING=https://iojs.org/dist/index.tab rvm_bin_path=/Users/chris/.rvm/bin TERM_PROGRAM=iTerm.app GEM_HOME=/Users/chris/.rvm/gems/ruby-2.1.6 TERM=screen-256color SHELL=/usr/local/bin/fish TMPDIR=/var/folders/cd/py8lhjdx4hxcgtd4vpjrnklr0000gn/T/ NVM_PATH=/Users/chris/.nvm/versions/node/v0.12.2/lib/node Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.BeAsaT9KcH/Render ORIGINAL_PATH=/usr/local/bin /usr/bin /bin /usr/sbin /sbin USER=chris NVM_DIR=/Users/chris/.nvm rvm_path=/Users/chris/.rvm SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Lph298rxJw/Listeners __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0 TMUX=/private/var/folders/cd/py8lhjdx4hxcgtd4vpjrnklr0000gn/T/tmux-501/default,53850,0 rvm_prefix=/Users/chris PATH=/Users/chris/.rvm/gems/ruby-2.1.6/bin:/Users/chris/.rvm/gems/ruby-2.1.6@global/bin:/Users/chris/.rvm/rubies/ruby-2.1.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/chris/.rvm/bin NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist __fish_sysconfdir=/usr/local/Cellar/fish/2.2.0/etc/fish PWD=/Users/chris/.config/omf __fish_datadir=/usr/local/Cellar/fish/2.2.0/share/fish LANG=en_US.UTF-8 ITERM_PROFILE=foobar XPC_FLAGS=0x0 TMUX_PANE=~ 

Is this normal?

derekstavis commented 9 years ago

I think I've found the issue (actually two issues) and fixed it. Please give a omf update and try again.

krzkrzkrz commented 9 years ago

I did omf update. I type fish, in the terminal. I still see the ---DIVIDER--- message

krzkrzkrz commented 9 years ago

Having:

fenv source ~/.vim/bundle/gruvbox/gruvbox_256palette.sh
fenv source ~/.nvm/nvm.sh\; nvm use 0.12.2

Returns:

contains: Unknown option '-iqE'
~/.local/share/omf/pkg/foreign-env/fenv.parse.diff.fish (line 30):         if not contains "$environment" $OLD_ENV
                                                                              ^
in function 'fenv.parse.diff'
        called on line 25 of file ~/.local/share/omf/pkg/foreign-env/fenv.main.fish
derekstavis commented 9 years ago

Please close all fish shells and try again. Also, can you paste me the output of your env?

krzkrzkrz commented 9 years ago

Ok, closing all fish shells works. However I get the issue when starting tmux:

contains: Unknown option '-iqE'
~/.local/share/omf/pkg/foreign-env/fenv.parse.diff.fish (line 30):         if not contains "$environment" $OLD_ENV
                                                                              ^
in function 'fenv.parse.diff'

env:

Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.BeAsaT9KcH/Render
COLORFGBG=15;0
GEM_HOME=/Users/chris/.rvm/gems/ruby-2.1.6
GEM_PATH=/Users/chris/.rvm/gems/ruby-2.1.6/Users/chris/.rvm/gems/ruby-2.1.6@global
HOME=/Users/chris
ITERM_PROFILE=foobar
ITERM_SESSION_ID=w0t0p0
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LOGNAME=chris
MANPATH=/Users/chris/.nvm/versions/node/v0.12.2/share/man:/Users/chris/.rvm/rubies/ruby-2.1.6/share/man:/usr/local/share/man:/usr/share/man:/Users/chris/.rvm/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
NVM_BIN=/Users/chris/.nvm/versions/node/v0.12.2/bin
NVM_DIR=/Users/chris/.nvm
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
NVM_IOJS_ORG_VERSION_LISTING=https://iojs.org/dist/index.tab
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
NVM_PATH=/Users/chris/.nvm/versions/node/v0.12.2/lib/node
ORIGINAL_PATH=/usr/local/bin/usr/bin/bin/usr/sbin/sbin
PATH=/Users/chris/.nvm/versions/node/v0.12.2/bin:/Users/chris/.rvm/gems/ruby-2.1.6/bin:/Users/chris/.rvm/gems/ruby-2.1.6@global/bin:/Users/chris/.rvm/rubies/ruby-2.1.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/chris/.rvm/bin
PWD=/Users/chris/Sites/foobar/team
RUBY_VERSION=ruby-2.1.6
SHELL=/usr/local/bin/fish
SHLVL=4
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Lph298rxJw/Listeners
TERM=screen-256color
TERM_PROGRAM=iTerm.app
TMPDIR=/var/folders/cd/py8lhjdx4hxcgtd4vpjrnklr0000gn/T/
TMUX=/private/var/folders/cd/py8lhjdx4hxcgtd4vpjrnklr0000gn/T/tmux-501/default,53850,2
TMUX_PANE=%5
USER=chris
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
__fish_bin_dir=/usr/local/Cellar/fish/2.2.0/bin
__fish_datadir=/usr/local/Cellar/fish/2.2.0/share/fish
__fish_help_dir=/usr/local/Cellar/fish/2.2.0/share/doc/fish
__fish_sysconfdir=/usr/local/Cellar/fish/2.2.0/etc/fish
is_vim=echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"
rvm_bin_path=/Users/chris/.rvm/bin
rvm_path=/Users/chris/.rvm
rvm_prefix=/Users/chris
rvm_version=1.26.11latest
derekstavis commented 9 years ago

The offending line is here:

is_vim=echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"

The problem is that the contents of variable is_vim contains spaces. This isn't very common, but I have yet to figure out a way to fix it, as fish interprets both newlines and spaces as list dividers.

derekstavis commented 9 years ago

Can you give another shot with omf update, closing all shells and reopening @krzkrzkrz ?

krzkrzkrz commented 9 years ago

Ok that seems to work!

But opening a new fish shell takes around a split second. On bash, much much much faster

I also see, when opening a new fish shell:

Now using node v0.12.2 (npm v2.7.4)
derekstavis commented 9 years ago

Yes, this is common, as foreign-env does a great amount of string manipulation work. The greater your environment, longer it will take.

By the way, I think that for this specific case using just sh ~/.vim/bundle/gruvbox/gruvbox_256palette.sh will have the same effect as passing it though fenv, as this script just does some printfs remapping colors. fenv was designed to be used only with applications that use bash export command, like nvm and other PATH manipulation tools.

derekstavis commented 9 years ago

I'm closing this issue as your reported success in running it. Now fenv it's protected from messing environment variables badly, something that happened to you. Thanks for your help!! :+1:

krzkrzkrz commented 9 years ago

No problem! Thanks for that. Wish the startup time could be faster though :)