- Oh My Zsh
- Custom Aliases
- Useful default aliases
- Use gcm + gco when rebasing
- Use shortcuts
- The F****
- Reverse search through command history
- Enable option/alt + left || right moves the cursor across words
- Enable "Reuse previous session's directory"
- VS Code
Powerful combo of Zsh + a bunch of useful plugins
alias y="yarn" alias ys="yarn start" alias yt="yarn test" alias gcm="git checkout master"
Useful default aliases
l # alias for ls -alh g # alias for git gco # alias for git checkout gss # alias for git status -s gcb # alias for git checkout -b glog # alias for git log --oneline --decorate --graph
Full cheat sheet: https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet or use the
alias command to see all available aliases
gco when rebasing
gcm # checkout master g pull # pull the latest master gco - # switch back to your working branch g rebase master g push -f
- # shortcut for cd - : go to previous directory ~ # shortcut for cd ~ : go home sudo !! # reruns previous command with sudo prefix. can also be done using `the eff`
Very useful plugin, not Zsh specific. Let's you jump to any directory that you've already visited using fuzzy matching. E.g.
j 2020 # jumps to ~/Projects/www-wrapped-2020 j mob # jumps to ~/Projects/client-web/open/mobile-web-player
The Eff, as I will call it in the interest of keep it PG, is a self described tool that "corrects errors in previous console commands". It's kind of like a command line linter
I change the alias from, literally,
brew install thefuck echo 'eval $(thefuck --alias sure)' >> ~/.zshrc
➜ git push fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master ➜ sure git push --set-upstream origin master [enter/↑/↓/ctrl+c] Counting objects: 9, done.
Reverse search through command history
Not Zsh specific. Use ctrl + R
- Pressing up 1 million times
history | grep foothis is is a good option if you want to use regexs to search through mor e rows
cmd + d # create a new vertical session shift + cmd + d # create a new horizontal session cmd + t # create a new tab session
Enable option/alt + left || right moves the cursor across words
In Profiles > Keys, add the following
Enable "Reuse previous session's directory"
In Profiles > General > Working Directory, check "Reuse previous session's directory"
This means that whenever you start a new session using cmd + D, it puts you in the pwd of the last session
I'll usually have one tab per "project/initiative", with one to four split session per tab, depending on the number of repos involved, e.g.
ysin the upper left
yt --watchin the lower left
zshshell on the whole right half
tmux, which should actually work in conjunction with iTerm2.
Follow the docs on launching from the command line. TLDR: cmd + P → seach for "install" → select "Shell Command: Install 'code' command in PATH"
This lets you open projects by doing