Make your terminal more usable
You're going to spend all day looking at your terminal. Make it be kind to you.
Part 1
Here's a video walk-through of part 1 of this guide:
tldr
tl;dr
stands for "too long; didn't read". It's a great tool, too.
to install, just do
$ brew install tldr
Then try the following commands:
$ tldr cd
$ tldr ls
$ tldr git
$ tldr git add
$ tldr git clone
... you get the idea
Git branch in your prompt, and git tab completion
We'll follow the git tab completion instructions from Learn Enough Git
In your terminal, enter the following commands:
$ curl -o ~/.git-prompt.sh -OL cdn.learnenough.com/git-prompt.sh
$ curl -o ~/.git-completion.bash -OL cdn.learnenough.com/git-completion.bash
Next, chmod
the permissions on them, using the following:
$ chmod +x ~/.git-prompt.sh
$ chmod +x ~/.git-completion.bash
OK. You've got what you need. We're now going to edit one more file:
Edit your ~/.bash_profile
The following should be in your ~/.bash_profile
file:
If you don't know where or what that file is, no problem.
To find it (or create it), cd
to your root directory ($ cd ~
and type ls -la
. look through the files that start with .
If a file called .bash_profile
is there, great. Open it in atom. If it's not, great, create it and open it in atom.
.
.
.
# if you have other stuff in this file, leave it. Just _add_ the following to the file.
source ~/.git-prompt.sh
PS1='[\W$(__git_ps1 " (%s)")]\$ '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
# Tab completion for branch names
source ~/.git-completion.bash
after making these changes (or any changes) to see them take effect, either quit and restart your terminal, or run
$ source ~/.bash_profile
from the command line.
Part 2: Make your prompt be offset-colors (and green-on-black, or whatever you want it to be.)
If you want your prompt to have an off-set color than the rest of your terminal, you can do so.
Here's a video walk-through of the next piece:
Open up your ~/.bashrc
, comment out any exisint references to your PS1
or export PROMPT_COMMAND
, and paste in the following:
# the following is random instructiosn from Josh Thompson. Here be dragons
# https://gist.github.com/josh-works/7f2e6c82d22dca6e9fbc029c8b17703d
# josh's non-default terminal settings
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
# from https://geoff.greer.fm/lscolors/
export LSCOLORS=GxBxhxDxfxhxhxhxhxcxcx
PS1="\[\e[32;40m\][\W$(__git_ps1 " (%s)")]\$\[\e[m\] "
# do you wonder what the heck these crazy characters do? check it out:
# https://twitter.com/aupajo/status/996232124284858370
And that's it. Run source ~/.bashrc
, and you should see the color offsets.
Don't forget to set your terminal background to black, and your text color to white, like so:
If you do it right, it'll all look like so: