Why still says no GOPATH though i've set it? - linux

Both GoSublime and vim-go tells me that GOPATH isn't set, however I've already done this.
my ~/.bashrc:
export GOPATH=$HOME/gopath
export PATH="$PATH:$GOPATH/bin"
and I can use go get to install gocode to my ~/gopath/bin
but it prints that: ...:/home/myusrname/gopath/bin: No such file or directory
for
~$ $PATH

~$ $PATH
is trying to execute your $PATH string, i.e. it's equivalent to writing the contents of the $PATH variable into the console and pressing enter. That results in the error you're seeing.
What you want is
~$ echo $PATH

finally i got it: i have to open gvim through shell with $GOPATH set - -!

You can try to start gvim with the command:
bash -lc gvim
It then starts gvim with the settings in your .bashrc file.
This is from https://github.com/fatih/vim-go/issues/468

In my case, I added GOPATH in my .profile
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
And restart my Unbuntu 16.04
Then for my vim-go, I installed the vim-go by the following command in gvim
:GoInstallBinaries

Related

Echo $JAVA_HOME returns empty despite being present in .bashrc, .bash_profile, .profile files

I've added the following line in all 3 files:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
If I do, echo $JAVA_HOME, I get empty line as output.
If I do source .bash_profile and then do echo $JAVA_HOME, I get the output correctly.
If I close the terminal application and re-open the terminal app again, echo $JAVA_HOMEshows empty again. Isn't .profile or .bash_profile supposed to load it to bash when I reopen? I added it to all 3 files to be sure. But it just doesn't seem to work
Note: I'm using Zsh on Mac. Does this have anything to do with what I'm facing?
Thanks #JoachimIsaksson for the solution in the comments. I had to move stuff to .zprofile for zshell on Mac and it worked.

I set .bashrc but my promt looks still the same

i'm quite new with linux and I want to tweak my terminal prompt. The default is user#user - Thinkpad- T420 ~$. That pretty annoying long.
I searched google and I tried my best but it didn't show any difference.
What i have done:
echo $PS1
\[\e]0;\u#\h \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u#\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]
locate bashrc
/etc/bash.bashrc
/etc/skel/#.bashrc#
/etc/skel/.bashrc
/etc/skel/.bashrc~
/usr/share/base-files/dot.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc
sudo -s Atom /directory
I changed in all files PS1="...." to PS1="hallo". Terminal prompt shows no difference.
Linux Kernel
Mint
4.8.0-53-generic
greetings ! B
source ~/.bashrc
Your terminal only reads the .bashrc on opening, or when you explicitly source it.
I fixed it by editing the .bashrc file in my /home/myusername directory. Don't edit the files here /src/skel

All bash commands lost after sourcing bash_profile after osx upgrade

I recently upgraded my osx to os x el capitan. I noticed that subl command was missing so I tried adding the path to my bash_profile. It didn't work out so I removed it and then do a source ~/.bash_profile and now all of my bash commands are gone.
Here is my bash_profile file
export $PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
##
# Your previous /Users/judyngai/.bash_profile file was backed up as /Users/judyngai/.bash_profile.macports-saved_2013-06-27_at_16:30:58
##
# MacPorts Installer addition on 2013-06-27_at_16:30:58: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/usr/local/sbin:$path
export PATH=/usr/local/bin:$PATH
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
:q!
and when I do export $PATH
I am getting this
31-34-238:bin judyngai$ export $PATH
-bash: export: `/usr/local/bin:/usr/local/sbin:': not a valid identifier
I cd into all of the directories that its getting searched through /usr/local/bin, /bin, /usr/local/bin etc. and saw all of the commands in there.
and this
31-34-238:~ judyngai$ source ~/.bash_profile
-bash: export: `/Users/judyngai/.rbenv/bin:/usr/local/bin:/usr/local/sbin:=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier
env: bash: No such file or directory
-bash: :q!: command not found
I actually think my bash_profile is fine so what is wrong? Rbenv and macport both look fine.
This line is destroying your path: export PATH=/usr/local/sbin:$path -- variables are case sensitive.
However, this error
-bash: export:`/usr/local/bin:/usr/local/sbin:': not a valid identifier
Indicates you probably have this in your bash_profile
export PATH=/usr/local/sbin:$path # PATH=/usr/local/sbin:
export PATH=/usr/local/bin:$PATH # PATH=/usr/local/bin:/usr/local/sbin:
export $PATH="$HOME/.rbenv/bin:$PATH"
# .....^
Where you are substituting the variable on the left-hand side instead of providing the variable name.
You export a variable (name), not a variable's value.

Path to vim and sudo executables

I've messed up my PATH variable by editing /etc/environment, I don't have rm, sudo or many commands. Can someone tell me the path to the vim and sudo executables so I can fix this
The path to vim can possibly vary, for vi it's /usr/bin/vi.
You can still fix your PATH by exporting it manually in shell as below:
Ubuntu default:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
CentOS default (tested on VM):
export PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:$HOME/.local/bin:$HOME/bin
You can also look for the binaries by the following commands (if you run sudo updatedb before):
locate vim | grep -w "vim$"
or:
type -a vim
The best would be to fix your PATH by adding the right values into the right rc file. Normally you set that in ~/.profile for the current user, or adding new as part of /etc/init.d scripts:
$ grep -R PATH /etc/init.d
/etc/init.d/functions:PATH="/sbin:/usr/sbin:/bin:/usr/bin"
/etc/init.d/functions:export PATH
/etc/init.d/netconsole:PATH=/sbin:/usr/sbin:$PATH
/etc/init.d/vboxadd:PATH=$PATH:/bin:/sbin:/usr/sbin
/etc/init.d/vboxadd-service:PATH=$PATH:/bin:/sbin:/usr/sbin
/etc/init.d/vboxadd-x11:PATH=$PATH:/bin:/sbin:/usr/sbin
Vim:
$ which vim
/usr/bin/vim
sudo:
$ which sudo
/usr/bin/sudo

How to make terminal recognize command "gvim" or "mvim"?

I am not sure I understand correctly from the readme file how to install vim onto my mac. After installation, I still cannot seem to open files while typing gvim HelloWorld.c into terminal. How can I permanently fix the gvim command for terminal to recognize all the time?
Mac OS X already ships with a slightly underpowered but perfectly working vim build so you only have to issue that command in your terminal:
$ vim filename
MacVim is a more featureful version that comes with a GUI and a CLI executable. Is that what you installed?
The archive you downloaded contains MacVim.app and a shell script called mvim.
If you don't plan to use Vim in or from your terminal, you don't need that mvim script at all.
If you do, the simplest solution is to put that script somewhere in your $PATH. To do so, check the value of $PATH with the following command:
$ echo $PATH
and copy the script into one of the listed directories:
$ cp /path/to/mvim /some/directory/mvim
After that's done, you can call the MacVim GUI from your terminal with:
$ mvim filename
or the MacVim CLI with:
$ mvim -v filename

Resources