How do I get virtualfish to work on OSx - macos

I have cloned virtualfish to my ~/clones/virtualfish
and as per the docs it says source virtual.fish from the above cloned directory of virtualfish inside ~/.config/fish/config.fish
Noting given on http://virtualfish.readthedocs.org/en/latest/install.html works !
Do I need to be in fish prompt or have it installed ?
how do I even know that fish is using .config/local/config.fish ?
how do I get bashrc and bash_profile to load up in fish prompt then ?

Yes, virtualfish is designed for the fish prompt, and so it's assumed you have it installed and are using it. If you want to use bash, you should use virtualenv instead.
The fish prompt does not use .bashrc or .bash_profile, as these are of course bash-specific.

Related

How do programs add to $PATH variable with using .bash_profile?

How do some programs seem to add to the $PATH variable without using a .bash_profile file? What are the advantages to these approaches of adding to $PATH variable, but not using a .bash_profile file?
For my mac
echo $PATH returns
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
which java returns
/usr/bin/java
which tex returns
/Library/TeX/texbin/tex
How is Java available in the terminal without being in the $PATH variable? (This is an example of something running in the terminal without being in the $PATH variable.)
How did TeX add to the PATH variable without using a .bash_profile file?
What added Library/Apple/usr/bin to the PATH variable? Wikipedia says that only the first three are defaults: /bin, /usr/bin, and /usr/local/bin.
Note: Other StackOverflow posts helped users create a .bash_profile file (a file that doesn't exist by default on a Mac) to run programs such as android and adb when they received -bash: android: command not found
My question is about how the terminal works (like how java is running without being on $PATH) and how other programs (like TeX) added to $PATH without using a file like .bash_profile.
I am running macOS 10.15.5, confirmed that I do not have a .bash_profile file, do have homebrew installed (not sure if that affects anything) and when I open a terminal, it says "The default interactive shell is now zsh." (I think I installed zsh after reading a different StackOverflow a few weeks back.

Cygwin Terminal and zsh strange characters used in username

Hi I've recently installed zsh using cygwin on my Windows machince but when I type zsh to start this I get the following:
GG#GG-PC ~
$ zsh
\[\e]0;\w\a\]\n\[\e[32m\]\u#\h \[\e[33m\]\w\[\e[0m\]\n\$
On my mac I am using iTerm2 and this is so much easier to setup on here. Also I am having trouble in setting up the aliases and this is becauses its not setup properly in terms of config file where I can set this up in a separate file.
Any ideas how I can resolve?
It looks like zsh is inheriting the value of PS1 from the previous shell. The PS1 environment variable sets the shell prompt, and zsh used a different format for prompt substitutions than other shells. Try entering the following command after you start zsh:
PS1=$'%{\e]0;%d\a%}\n%F{green}%n#%m %F{yellow}%d%f\n%# '
If that works, add that line to your ~/.zshrc file.
That's also probably a good place to put your aliases.
There might be an issue because you launch zsh from bash actually and not cygwin.
One thing you can do is to launch zsh as the starting shell of mintty (the window that wraps your shell)
Create a shortcut with this inside:
c:\<cygwin-folder>\bin\mintty.exe -i /Cygwin-Terminal.ico /usr/bin/zsh --login -
Yo need to update .zshrc with your required theme and then
source .zshrc

bash won't change prompt when executed from zsh

I use zsh, but we have some scripts that require bash and won't work in zsh. Basically what script does - it sets bunch of env vars and activates python VE. Usually when you activate python VE natively in bash, it changes the prompt:
mbp-ag:web-pr
mbp-ag:web-pr ag$ source etc/setup.bash
(ve)mbp-ag:web-pr ag$
See those parentheses? Now my problem is, when I run bash from zsh and activate python VE it activates it, but doesn't change the prompt. I don't like that
There's a mention here of someone with the same problem as you. Their solution was to edit the PS1 shell variable in the bin/activate file:
https://unix.stackexchange.com/questions/87062/how-to-display-the-name-of-the-current-virtualenv
There's also this ZSH plugin for virtualenv: https://github.com/tonyseek/oh-my-zsh-virtualenv-prompt
Quote:
It support to customize the virtualenv prompt in oh-my-zsh themes.
I've figured out... zsh with antigen and plugins handles prompt for pyenvs,
it sets VIRTUAL_ENV_DISABLE_PROMPT=1. Once I unset that in bash profile, it works
the prompt is a variable assigned to "PS1" so do something like
PS1="{new prompt}"
for example:
-bash-4.1$ PS1=">"
>

Bash alias when running Perlbrew

I am using Perlbrew in a brand new server (CentOs 6).
In my previous system (RedHat 4) WiTHOUT Perlbrew I used to use some aliases in the bash shell, like alias nreload='/usr/local/nginx/sbin/nginx -s reload' for example, to restart Nginx just putting the line in the .bash_profile file.
Now, with Perlbrew, I tried it in .bash_profile and in .bashrc, with no luck. I can make aliases on the fly, but I can't have them permanently available.
I followed the Perlbrew installation tips and copied the line source ~/perl5/perlbrew/etc/bashrc in the .bashrc file. I thought it should activate the Perlbrew Perl just by logging-in to the server, but it doesn't. So I must write source ~/perl5/perlbrew/etc/bashrc; everytime I need to use the Perlbrew Perl. It doesn't seems to be the right way.
Maybe the real problem is how I run Perlbrew. Maybe I do not understand the concept of Perlbrew opening another shell. If there is another shell, a subshell, how can I use alias in it?
Here is the content of my .bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
source ~/perl5/perlbrew/etc/bashrc
export PATH
alias nreload='/usr/local/nginx/sbin/nginx -s reload'
BTW: the server is a remote one, and I control it from a local Macintosh, using Terminal. I have read something about Terminal is more a visual tool than a real Unix terminal, but I do not completely understand it.
I have found the way: aliases must be in .bashrc
I connect using (Macintosh) Terminal, and when logged to the online server I just "activate" a new shell typing "/bin/bash".
In this new shell I have the right Perlbrew Perl, an all the alias, because this new shell takes everything from the .bashrc file.
What confused me was that "a new shell" is not really "a new terminal window" as I was expecting, but a new "process", and this new process, obviously uses .bashrc as a start point.

How to use correct ruby in vim ? How to modify $PATH in VIM?

I use plain Vim with ruby support on Lion (installed by gist). I am using ruby with rbenv so my path looks like /users/me/.rbenv/shims:.....
From within vim the path is
:!echo $PATH
> usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/fb/.rbenv/shims:....
Even I can create and modify an environment variable:
:let $PATH = "/bar:/foo"
:!echo $PATH
> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/foo:/bar
paths remains starting with /usr/bin.
So how can I access my ruby 1.9.3 in ~/.rbenv/shims instead the system ruby in /usr/bin ?
This is a known problem introduced by Apple in OS X 10.5 Leopard.
If you are using Bash or Zsh and are using non-interactive shells, you are affected.
Running sudo chmod ugo-x /usr/libexec/path_helper will fix you up, but you should take a look at the article to see why.
rvm also has this problem. If zsh is your default shell when it starts /etc/zshenv gets executed.
This executes /usr/libexec/path_helper. That sets up the path based on the contents /etc/paths and /etc/paths.d/.
The faq for rvm mentions moving /etc/zshenv to /zsh/zshrc. I did this and it removed the /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin from the start of my path in macvim.
I did'n t set the shell option in .vimrc, so that it was automatically set to /bin/zsh.
Then I found out that I hab a dublicate initialisation of rbenv: in my .zshrc. I removed the initialisation end $PATH extensioin in .zshrc because that was already handled by the oh-my-zsh rbenv plugin.
Even after that cleanup, the $PATH mangeling still happening so :!echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/fb/.rbenv/shims:/Users/fb/.rbenv/bin:/Users/fb/bin:/usr/local/sbin:/usr/games
Setting :set shell=/bin/bash was what helped me, as i can live with bash in my vim: :!echo $PATH
/Users/fb/.rbenv/shims:/Users/fb/.rbenv/bin:/Users/fb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/Users/fb/Dropbox/local/bash
In your ~/.bashrc (or whatever shell you're using) file, add the following line:
PATH=/home/me/.rbenv/shims:${PATH}
and then run source ~/.bashrc (or .zshrc or whatever shell you're using!)
This can be fixed by just adding
PATH=/home/me/.rbenv/shims:${PATH}
to
/etc/zshenv
I don't use mac or zsh (I am on linux), however I ran into this problem when I ran gvim from the MATE Menu.
I solved it by adding this to my .vimrc:
if $PATH !~ "\.rbenv"
let $PATH="/home/username/.rbenv/shims:/home/username/.rbenv/bin:" . $PATH
endif
This avoids setting it if you run vim from a terminal, otherwise the rbenv paths would be included twice.
I tried setting the application to run via a terminal, but that didn't help.
yes on OS X it's the bash_profile that gets sourced when opening a new console window whereas on Linux it's your bashrc

Resources