It's dangerous out there! here are some scripts to help you on your shell adventures.
This repo is a collection of personal preferences and configuration settings I've gathered and tweaked from around the web. Use them wisely and share.
This requires Homebrew and Homebrew Bundle in OS X. Use the following to install all deps:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update && brew bundle
Util scripts and helper functions are linked under the
$BREW_PATH/share/zsh/site-functions
folder. These should be included in
$fpath
.
These include the syntax-highlighting and zsh-completions plugins and z
so
you can zump around.
NOTE: If completions aren't working for some reason, you might want to try rebuilding the cache:
rm -f ~/.zcompdump; compinit
You can compile the additional helpers via the following:
rm -f functions/*.zwc
for f (functions/*) zcompile $f
export BREW_PATH=$(brew --prefix)
ln -s "$HOME/github/zsh-history-substring-search/zsh-history-substring-search.zsh" $BREW_PATH/share/zsh/site-functions
ln -s "$HOME/github/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" $BREW_PATH/share/zsh/site-functions
ln -s "$HOME/github/z/z.sh" $BREW_PATH/share/zsh/site-functions/z.zsh
ln -s "$HOME/github/zsh-completions/src" $BREW_PATH/share/zsh/vendor-completions
Disable analytics, link autocompletions by default:
brew analytics off && \
brew completions link
Install public keys on host:
curl -sSL https://github.com/${USERNAME}.keys -o ~/.ssh/authorized_keys
Some of these were originally available on Stefan Klumpp's Geek!mind and are a nice reminder of how to get things done quicker.
Ctrl+A
- Move to the beginning of the line
Ctrl+E
- Move to the end of the line
Alt+B
- Move one word backward
ALT+F
- Move one word forward
Ctrl+U
- Clear the entire line
Ctrl+K
- Clear the characters on the line after the current cursor position
Ctrl+W
| Ctrl+Backspace
- Delete the word in front of the cursor
Alt+D
- Delete the word after the cursor
Ctrl+R
- Search history (press again to find next match, pressing Right arrow
allows you to edit current selected value)
Ctrl+S
- Forward-search history Useful for those times when you went one Ctrl+R
too far. Remember to issue a stty -ixon
on your .bashrc
or .zshrc
configuration to unbind XON/XOFF occurrences
Ctrl+G
- Quit search mode
Ctrl+_
- Undo last change
Ctrl+L
- Clear screen
Ctrl+S
- Stop output to screen
Ctrl+Q
- Re-enable screen output
Ctrl+C
- Terminate/kill current foreground process
Ctrl+Z
- Suspend/stop current foreground process
See the bindkey
builtin for a more extensive list.
.zshenv → [.zprofile if login] → [.zshrc if interactive] → [.zlogin if login] → [.zlogout sometimes]
zshenv
is the entrypoint and always sourced.
zprofile
is meant as an alternative to .zlogin; the two are not intended to be
used together. Loads before zshrc instead of after and hands things off to
zshrc
.
Expression | Description |
---|---|
!! |
Execute last command in history |
!* |
Access last command's params eg: vim !* |
!^ |
Access last command's first param |
!$ |
Access last command's last param |
!?abc?:* |
Params of last abc command |
!abc |
Execute last command in history beginning with abc |
!abc:p |
Print last command in history beginning with abc |
. ~/.zshrc |
Reload your zsh configuration |