1
0
Fork 0

Improve zshrc for macOS
the build failed Details

main
Ambrose Chua 2018-10-17 14:52:42 +08:00
parent 7be1a8331a
commit 131ed2ccb6
1 changed files with 52 additions and 36 deletions

88
.zshrc
View File

@ -26,7 +26,11 @@ bindkey '^R' history-incremental-search-backward
fpath=( $HOME/.zsh/functions $fpath ) fpath=( $HOME/.zsh/functions $fpath )
# ls colors # ls colors
eval $(dircolors -b $HOME/.dircolors) if [[ "$(uname -s)" -eq "Darwin" ]]; then
eval $(gdircolors -b $HOME/.dircolors)
else
eval $(dircolors -b $HOME/.dircolors)
fi
# editor # editor
export EDITOR=nvim export EDITOR=nvim
@ -56,41 +60,53 @@ alias vim=nvim
# gpg as ssh agent # gpg as ssh agent
test -e "$(which gpgconf)" && export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" test -e "$(which gpgconf)" && export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
# macOS GOPATH
if [[ "$(uname -s)" -eq "Darwin" ]]; then
export GOPATH="$HOME/Documents/go"
fi
# iTerm2 integration # iTerm2 integration
test -e "$HOME/.iterm2_shell_integration.zsh" && source "$HOME/.iterm2_shell_integration.zsh" test -e "$HOME/.iterm2_shell_integration.zsh" && source "$HOME/.iterm2_shell_integration.zsh"
# hack to optionally get some oh-my-zsh back
export ZSH="$HOME/.oh-my-zsh"
test -e "$HOME/.oh-my-zsh/plugins/osx/osx.plugin.zsh" && source "$HOME/.oh-my-zsh/plugins/osx/osx.plugin.zsh"
# legacy scripts
test -e "$HOME/.bin" && export PATH="$HOME/.bin:$PATH" # TODO: move to .local/bin
# tips # hack to optionally get some oh-my-zsh back
function tips { if [[ "$(uname -s)" -eq "Darwin" ]]; then
echo "Some useful commands:"
echo " - spotify || itunes Chill out to 🎧" export ZSH="$HOME/.oh-my-zsh"
echo " - cdf Jumps to the folder open in finder" test -e "$HOME/.oh-my-zsh/plugins/osx/osx.plugin.zsh" && source "$HOME/.oh-my-zsh/plugins/osx/osx.plugin.zsh"
echo " - quick-look Opens file in quick look 👀" # legacy scripts
echo " - asciinema Records a terminal session" test -e "$HOME/.bin" && export PATH="$HOME/.bin:$PATH" # TODO: move to .local/bin
echo " - http Make HTTP requests"
echo " - ghi GitHub Issues" # tips
echo " - todo [task] What it says on the tin 🗒" function tips {
echo " - nope When you give up on life 😖" echo "Some useful commands:"
echo " - imgcat photo Preview photo inline" echo " - spotify || itunes Chill out to 🎧"
echo " - it2dl file Downloads file" echo " - cdf Jumps to the folder open in finder"
echo " - ^R Searches history" echo " - quick-look Opens file in quick look 👀"
echo " - ^Z Suspend process" echo " - asciinema Records a terminal session"
echo " - ⌘ B In Finder, open a iTerm window" echo " - http Make HTTP requests"
echo echo " - ghi GitHub Issues"
echo "In vim:" echo " - todo [task] What it says on the tin 🗒"
echo " - ctrl-v, shift-i, //" echo " - nope When you give up on life 😖"
echo " - o (insert in new line) a (append) A (append at end) c (change selection)" echo " - imgcat photo Preview photo inline"
echo " - w (start of word) e (end of word) 0 (start of line) $ (end of line)" echo " - it2dl file Downloads file"
echo " - k (up) j (down) h (left) l (right)" echo " - ^R Searches history"
echo " - ~ (swap case) U (uppercase) u (lowercase) gUU guu gu$ gu0 gUaw" echo " - ^Z Suspend process"
echo " - % (jump to matching brackets)" echo " - ⌘ B In Finder, open a iTerm window"
echo " - (jump to line in screen) H (top) M (middle) L (bottom)" echo
echo " - (jump by screen to line) ctrl-u (half up) ctrl-d (half down)" echo "In vim:"
echo " - (scroll screen, put current line at) z. (center) z+ (top) z- (bottom)" echo " - ctrl-v, shift-i, //"
echo " - (scroll screen by one line) ctrl-y (up) ctrl-e (down)" echo " - o (insert in new line) a (append) A (append at end) c (change selection)"
echo " - mx (mark as x) \`x (return to x)" echo " - w (start of word) e (end of word) 0 (start of line) $ (end of line)"
} echo " - k (up) j (down) h (left) l (right)"
echo " - ~ (swap case) U (uppercase) u (lowercase) gUU guu gu$ gu0 gUaw"
echo " - % (jump to matching brackets)"
echo " - (jump to line in screen) H (top) M (middle) L (bottom)"
echo " - (jump by screen to line) ctrl-u (half up) ctrl-d (half down)"
echo " - (scroll screen, put current line at) z. (center) z+ (top) z- (bottom)"
echo " - (scroll screen by one line) ctrl-y (up) ctrl-e (down)"
echo " - mx (mark as x) \`x (return to x)"
}
tips
fi