Repeatable dev environment config
cd ~/Documents
git clone https://github.com/josephhaaga/dotfiles && cd dotfiles
# Install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Install Brew dependencies
brew bundle
# brew bundle --force cleanup
# https://gist.github.com/ChristopherA/a579274536aab36ea9966f301ff14f3f
# install oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Restart Terminal.app to reload .zshrc
rest
# Symlink config files to user directory
ln -s ~/Documents/dotfiles/.config ~
# install tmux plugins
# Run <C-b> + I to install Tmux plugins
# yabai: install scripting addition (enables most features)
echo "$(whoami) ALL=(root) NOPASSWD: sha256:$(shasum -a 256 $(which yabai) | cut -d " " -f 1) $(which yabai) --load-sa" | sudo tee /private/etc/sudoers.d/yabai
# start window manager (yabai) + hotkey manager (skhd)
yabai --start-service
skhd --start-service
# re-install neovim to fix python-provider (powers many vim plugins)
$ python3 -m pip install --user --upgrade pynvim
$ brew reinstall neovim
# install Vim plugins via vim-plug
vim -c ':PlugInstall'
To install the Terminal.app theme, open Terminal, go to Terminal > Preferences > Profiles and click Import under the ...
button at the bottom
To install tmux plugins, open tmux
and hit Prefix + I.
- If you don't see anything, open
tmux
and then try runningtmux source ~/.tmux.conf
as per the tpm README
How to install Vim plugins
Intro to tmux
Install Powerline fonts for Agnoster-based oh-my-zsh themes
VimAwesome – list of Vim resources
- better articulate dependencies that cause
.zshrc
errors on Terminal startbrew
installs neovim, but we need to set the global python and re-install neovim so YouCompleteMe installs can compile
- install zsh
- install oh-my-zsh
- update .zshrc
- scripts (e.g. journal, tomorrow, notes) are on path, or aliased
- figure out the .oh-my-zsh submodule, and find a better location for josephhaaga.zsh-theme
- profile and speed up new window/tab creation
Control + b is my Prefix. (a.k.a C-b)
# start tmux
$ tmux
# list sessions
$ tmux ls
# attach to previous session
$ tmux a
# delete all sessions except current one
$ tmux kill-session -a
Split horizontally: Prefix + |
Split vertically: Prefix + -
Switch pane: Prefix + h,j,k,l
Move pane left: Prefix + shift + [
Flip panes horizontally: Prefix + cmd + o
Switch split orientation: Prefix + Space
Enter select mode: Prefix + [
Begin selection: v
Begin line selection: V
Exit select mode: q
Create new window: Prefix + c
See all commands: Prefix + ?
Start recording pane: :pipe-pane 'cat >~/mypanelog
Stop recording pane: :pipe-pane
Renumber windows starting at 1: Prefix + :move-window -r
Move window to: Prefix + .
Help: Prefix + ?
list-keys
to view all key bindings
I use Homebrew, the popular OS X package manager, to install most of my desktop applications (e.g. Chrome).
Run brew bundle
in a directory containing a Brewfile
to install all listed applications.
Run brew bundle dump
to generate a Brewfile
Run brew services
to see all services (including skhd
, yabai
, spacebar
etc.
brew services stop --all
andbrew services start --all
usually fixes any issues
How to use Homebrew with multiple OS X users
- UPDATE: now I'm using a designated admin account (
brewadmin
) to own thebrew
installation
I use neovim and vim-plug
, a popular plugin manager written by junegunn.
Append an exclamation point to every line: :%norm A!
Append an exclamation point to selected lines: Control + v (to select lines), and then :norm A!
Replace selection: I forgot how to do this; best to just yank the text from visual mode and paste into your :%s/HERE/replacement/g
command
%
means entire documents
means replaceg
means all occurrences on a line, not just the first match Open link under cursor: g x Clear and redraw screen: Control + l
https://neovim.io/doc/user/various.html#various
View all themes: :Telescope colorscheme
Set background on start: vi +"set background=light"
Set colorscheme on start: vi +"colorscheme peachpuff"
The default shell in OS X is now zsh
. I use a popular customization framework called oh-my-zsh
for terminal theming, handy aliases etc.
Reload by running omz reload
Customize PS1 by altering prompt_context()
in josephhaaga.zsh-theme
- the
%m
characters are called "prompt sequences" (see "Expansion of Prompt Sequences" inman zshmisc
)
Themes are from lysyi3m/macos-terminal-themes
nodemon
can run a command when a file/directory changes
nodemon -w my_directory -e .py -x "clear; python3 my_directory/t.py"