1
0
Fork 0
env/.zshrc

115 lines
3.2 KiB
Bash
Raw Normal View History

2018-04-01 17:06:16 +08:00
# terminal settings
2018-10-09 20:36:55 +08:00
#export TERM=xterm-256color
2018-04-01 17:06:16 +08:00
# zsh settings
2018-10-10 21:48:14 +08:00
export SAVEHIST=10000
2018-10-17 10:28:55 +08:00
export HISTFILE=$HOME/.zsh_history
2018-04-02 22:10:30 +08:00
setopt append_history
setopt extended_history
setopt share_history
setopt histignorespace
setopt longlistjobs
setopt notify
setopt completeinword
setopt noshwordsplit
setopt auto_cd
setopt interactivecomments
setopt extended_glob
2018-04-01 17:06:16 +08:00
2018-10-09 20:36:55 +08:00
autoload -U compinit; compinit
2018-10-28 18:18:18 +08:00
# basic keybindings
2018-10-09 20:36:55 +08:00
bindkey -v
2018-10-28 18:18:18 +08:00
bindkey "^[[1~" beginning-of-line
bindkey "^[[3~" delete-char
bindkey "^[[4~" end-of-line
bindkey "^R" history-incremental-search-backward
2018-10-09 20:36:55 +08:00
2018-10-09 19:03:43 +08:00
# zsh imports
2018-10-17 10:28:55 +08:00
fpath=( $HOME/.zsh/functions $fpath )
# ls colors
2018-10-17 14:52:42 +08:00
if [[ "$(uname -s)" -eq "Darwin" ]]; then
2018-10-28 18:18:18 +08:00
#eval $(gdircolors -b $HOME/.dircolors)
export CLICOLOR=1
2018-10-17 14:52:42 +08:00
else
eval $(dircolors -b $HOME/.dircolors)
fi
2018-10-09 19:03:43 +08:00
2018-09-22 20:43:47 +08:00
# editor
export EDITOR=nvim
2018-04-02 12:40:37 +08:00
# pure
2018-10-09 20:36:55 +08:00
export PURE_PROMPT_SYMBOL='>'
export PURE_PROMPT_VICMD_SYMBOL='<'
2018-04-02 12:40:37 +08:00
autoload -U promptinit; promptinit
prompt pure
2018-09-22 20:43:47 +08:00
# autosuggestions
2018-10-17 10:28:55 +08:00
source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
2018-10-09 19:03:43 +08:00
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=239'
export ZSH_AUTOSUGGEST_USE_ASYNC=true
bindkey '^e' autosuggest-accept
2018-09-22 20:43:47 +08:00
2018-04-02 23:05:10 +08:00
# thefuck
2018-10-09 19:03:43 +08:00
export PATH="$HOME/.local/bin:$PATH"
2018-04-02 23:05:10 +08:00
eval $(thefuck --alias nope)
2018-04-01 17:06:16 +08:00
# golang
2018-10-28 18:18:18 +08:00
if [[ "$(uname -s)" -eq "Darwin" ]]; then
export GOPATH="$HOME/Documents/go"
fi
2018-04-01 17:06:16 +08:00
export PATH="$(go env GOPATH)/bin:$PATH"
# aliases
alias vim=nvim
2018-10-17 10:28:55 +08:00
# gpg as ssh agent
test -e "$(which gpgconf)" && export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
# iTerm2 integration
2018-10-10 23:15:47 +08:00
test -e "$HOME/.iterm2_shell_integration.zsh" && source "$HOME/.iterm2_shell_integration.zsh"
2018-10-17 14:52:42 +08:00
2018-10-17 10:28:55 +08:00
# hack to optionally get some oh-my-zsh back
2018-10-17 14:52:42 +08:00
if [[ "$(uname -s)" -eq "Darwin" ]]; then
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
function tips {
echo "Some useful commands:"
echo " - spotify || itunes Chill out to 🎧"
echo " - cdf Jumps to the folder open in finder"
echo " - quick-look Opens file in quick look 👀"
echo " - asciinema Records a terminal session"
echo " - http Make HTTP requests"
echo " - ghi GitHub Issues"
echo " - todo [task] What it says on the tin 🗒"
echo " - nope When you give up on life 😖"
echo " - imgcat photo Preview photo inline"
echo " - it2dl file Downloads file"
echo " - ^R Searches history"
echo " - ^Z Suspend process"
echo " - ⌘ B In Finder, open a iTerm window"
echo
echo "In vim:"
echo " - ctrl-v, shift-i, //"
echo " - o (insert in new line) a (append) A (append at end) c (change selection)"
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