zsh
is a more useful shell than bash
, in my opinion, so we'll change your default shell from bash
to zsh
.
Follow instructions here: https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#macos
Note: zsh uses the ~/.zshrc
file instead of ~/.bash_profile
, so you should move anything that you need in your ~.bash_profile
to the ~.zshrc
.
This supplies a bunch of useful zsh
features, and gives you a basic
.zshrc
that sets them up.
Run the command shown here: https://github.com/ohmyzsh/ohmyzsh#via-curl
Once you've installed oh-my-zsh
, we'll add some plugins. In your .zshrc
,
there should now be a line that starts with plugins=
. Replace that line with the following:
plugins=(brew command-not-found git github history-substring-search fasd osx python)
Each name inside the parenthesis (separated by spaces) is the name of an oh-my-zsh plugin.
In particular, the history-substring-search
plugin is very useful: it lets
you type in any part of a command and then cycle through matches from your
command history.
For example, if a long time ago you typed a command rsync -vah ~/long/path/name/ ~/another/long/path/
and you want to run it again,
you could do the following:
- Type
syn
- Press the up arrow
- Keep pressing the up arrow, cycling through all commands in your history
that contain the substring
syn
until you get to the longrsync
command - Press enter
This is much easier than repeatedly pressing the up arrow to cycle through your entire command history until you reach the desired command. See here for more information.
I use the miniconda3
distribution from Anaconda:
https://docs.conda.io/en/latest/miniconda.html
Once you've installed Miniconda, add its binaries to the PATH
by adding this line to your .zshrc
:
export PATH="$HOME/miniconda3/bin:$PATH"
Now confirm that you're using the Miniconda Python:
- Open a new shell (a new Terminal tab or Window)
- Run
which python
- Check that the output is a path that has
miniconda3
in it
This will make your command line prompt nice.
pip install powerline-status
- Find out where powerline was installed by running
python
and then running the following in the Python REPL:This should print a path to the powerline module, which you'll use below.>>> import powerline >>> powerline
- Put these lines in your
.zshrc
:wherepowerline-daemon --quiet source "<path_to_powerline>/bindings/zsh/powerline.zsh"
<path_to_powerline>
is replaced with the path that you found in the previous step. - Install powerline fonts:
git clone https://github.com/powerline/fonts cd fonts ./install.sh
- In iTerm2, set your font to be
Roboto Mono for Powerline
(or any other font that has "for Powerline" in the name).
This will let you jump around your filesystem on the command line instead of having to laboriously type out paths. See here for more info.
- Install it:
git clone https://github.com/clvv/fasd cd fasd make install
- Put these lines in your
.zshrc
:# Initialize fasd eval "$(fasd --init auto)" # Use `j` to jump around alias j='fasd_cd -d'
There's a lot more to it than this. Check the README to see what else it can do.
This will let you efficiently arrange windows with keyboard shortcuts, instead of having to click and drag to move and resize windows.
- Download and install the Slate window manager here: https://github.com/jigish/slate#installing-slate. Important: Note the part about turning on the Accessibility API; this is needed to allow Slate to control your windows.
- Configure slate. Slate uses a configuration file that sets up key bindings
that arrange your windows. My configuration file is here:
https://github.com/wmayner/dotfiles/blob/master/slate/slate.symlink. It
has comments in it that describe the key bindings and what they do.
Download this and move it to
~/.slate
by runningmv <path_to_downloaded_file> ~/.slate
. - Run Slate and make sure it runs on startup by clicking its icon in the menu bar and checking that option in the dropdown menu.
This is the basic setup. There's a lot of other stuff in my dotfiles
repo which you might want. Also, you
can check my setup against yours to debug it in case something here isn't
working. In particular, check the
.zshrc
.