summary refs log tree commit diff
path: root/.zshrc
blob: 974875203c853a0414b9f25ab69f50191e9f89ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
unsetopt beep
setopt nomatch interactive_comments
HISTFILE=~/.history
HISTSIZE=SAVEHIST=5000
setopt inc_append_history hist_ignore_dups

autoload -Uz compinit && compinit
autoload -Uz colors && colors

bindkey -v
KEYTIMEOUT=1

PATH=$PATH:~/.bin
export PAGER=less EDITOR=vim GIT_EDITOR=vim
type nvim > /dev/null && EDITOR=nvim GIT_EDITOR=nvim && alias vim=nvim
export GPG_TTY=$TTY

export CLICOLOR=1
[[ "$OSTYPE" = 'linux-gnu' ]] &&
  alias ls='ls --color' grep='grep --color' rm='rm -I'

alias gcl='git clone'
alias gs='git status -sb'
alias ga='git add'
alias gc='git commit'
alias gca='git commit --amend'
alias gmv='git mv'
alias grm='git rm'
alias gst='git stash'
alias gt='git tag'
alias gsh='git show'
alias gco='git checkout'
alias gb='git branch'
alias gm='git merge'
alias gp='git push'
alias gf='git fetch'
alias gu='git pull'
alias gr='git rebase'
alias grc='git rebase --continue'
alias grs='git rebase --skip'
alias gra='git rebase --abort'
alias gd='git diff'
alias gl='git log --graph --pretty=log'

setopt prompt_subst
[[ -n "$SSH_CLIENT" ]] && _prompt_ssh="$fg[magenta]"
_prompt_git() {
  local dotgit=.git head
  [[ -d "$dotgit" ]] || dotgit=../.git
  [[ -d "$dotgit" ]] || return 0
  read head < "$dotgit/HEAD"
  case "$head" in
    ref:*) echo ":${head#*/*/}";;
    *) echo ":${head:0:7}";;
  esac
}
PROMPT='%{%(?.$fg[green]$_prompt_ssh.$fg[red])%}»%{$reset_color%} '
RPROMPT='%{$fg[blue]%}%50<…<%~%{$fg[yellow]%}$(_prompt_git)%{$reset_color%}'

typeset -ga preexec_functions precmd_functions

_n() { _n() { echo } }
precmd_functions+=(_n)

_title() { print -Pn "\e]0;$@\a" }
_title_precmd() { _title "%1~" }
_title_preexec() { _title "%1~: $1" }
precmd_functions+=(_title_precmd)
preexec_functions+=(_title_preexec)

[[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh
if [[ -d /usr/local/share/chruby ]]; then
  source /usr/local/share/chruby/chruby.sh
  chruby ruby
fi

true
mptationJune McEnroe 2018-08-26Add NetBSD to install.shJune McEnroe 2018-08-24Show hostname in title over SSHJune McEnroe 2018-08-23Alias bc='bc -l'June McEnroe 2018-08-20Update usage of scheme in READMEJune McEnroe 2018-08-20Use scheme.h in fbatt and fbclockJune McEnroe 2018-08-20Generate scheme.hJune McEnroe 2018-08-20Add dependencies on gfx.hJune McEnroe 2018-08-18Add Blondie — Heart of GlassJune McEnroe Why didn't I know about this song? I love it. 2018-08-18Set FCEDIT=$EDITORJune McEnroe 2018-08-18Only post commits with bodies to MastodonJune McEnroe 2018-08-18Run tf/cfg link script with /bin/shJune McEnroe 2018-08-18Run {,s,t}up with /bin/shJune McEnroe 2018-08-18Use whence instead of typeJune McEnroe type is an alias for whence -v and is more for human consumption. 2018-08-18Cut off path components until right prompt fitsJune McEnroe Keeps paths valid (from somehwere) rather than abrupt truncation. 2018-08-17Add "private" alias to source encrypted fileJune McEnroe Why is there no easy way to *edit* an encrypted file? 2018-08-17Add vim mapping to add a #includeJune McEnroe