dotfiles/zshrc

103 lines
2.8 KiB
Bash
Raw Normal View History

2021-03-29 19:10:02 +00:00
# $HOME/.config/zsh/.zshrc
# Note: Install zsh-completions package
setopt hist_find_no_dups
setopt extended_history
setopt inc_append_history
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushd_silent
setopt pushd_minus
setopt pushd_to_home
setopt prompt_subst
# Prompt
prompt_git_info () {
bn=$(git bn 2>/dev/null)
if [[ $? -eq 0 ]]; then
echo " %F{#aaaaaa}(%F{green}$bn%F{#aaaaaa})"
fi
}
PROMPT='%F{#666666}[%F{#AAAAAA}%n%F{#aaaaaa}@%F{red}%m %F{blue}%1~$(prompt_git_info)%F{white}%F{#666666}]%F{white}%# %f'
RPROMPT='%(?.%F{green}√%f.%F{red}%?%f) %F{#666666}%*%f'
# Completion
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' menu select=1
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '/home/rob/.config/zsh/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Search using up/down cursors
# https://unix.stackexchange.com/a/285151/185944
# Note that the Up and Down shortcuts appear to work in Ubuntu, not in Arch:
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[[A" up-line-or-beginning-search # up
bindkey "^[[B" down-line-or-beginning-search # down
2020-06-26 12:19:50 +00:00
2021-03-29 19:10:02 +00:00
# Vim keymap
bindkey -v
bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^w' backward-kill-word
2020-06-26 12:19:50 +00:00
2020-07-01 09:51:53 +00:00
# Other aliases
2021-03-19 14:03:28 +00:00
alias c-="cd -"
2021-03-29 19:10:02 +00:00
alias c.="cd .."
2021-03-24 08:16:09 +00:00
alias cdg=cdgit
2021-03-29 19:10:02 +00:00
alias cdgit='cd $(git rev-parse --show-toplevel)'
alias clp="tmux kill-pane"
alias clw="tmux kill-window"
alias d="dirs -v"
alias dc="docker-compose -f docker-compose.yml"
alias dcd="docker-compose -f docker-compose.yml -f docker-compose.development.yml"
alias gb="go build"
alias gc="git commit"
alias gd="git diff"
2021-03-26 16:24:46 +00:00
alias gg="go get"
2021-03-29 19:10:02 +00:00
alias gp="git push"
alias gst="git status"
2021-03-26 16:24:46 +00:00
alias gt="go test"
2021-03-15 15:29:40 +00:00
alias ll="exa -l --group-directories-first --git"
2021-03-29 19:10:02 +00:00
alias ls="exa --color=auto"
2021-03-15 15:29:40 +00:00
alias pg="pgrep -fa"
2021-03-29 19:10:02 +00:00
alias pk="pkill -fc"
alias rez="source $HOME/.zshenv && source $ZDOTDIR/.zshrc"
2021-03-29 19:10:02 +00:00
alias sc="systemctl"
alias sysc="systemctl"
alias zzz="sudo systemctl hibernate"
2020-07-01 09:51:53 +00:00
# recursive grep with line numbers and colour, ignoring binary files:
2020-07-30 12:51:44 +00:00
alias gnr="grep -nR -I --color"
2020-07-01 09:51:53 +00:00
# same but case-insensitive:
2020-07-30 12:51:44 +00:00
alias gnri="grep -nRi -I --color"
2020-07-01 09:51:53 +00:00
2020-06-26 12:19:50 +00:00
# On boot, power on bluetooth and start xfce
if [ $(tty) = "/dev/tty1" ]; then
bluetoothctl power on
startx
fi
# For Ubuntu, disable Caps-Lock:
setxkbmap -option caps:none
2021-01-06 13:34:33 +00:00
2021-03-29 19:10:02 +00:00
# Set zshfunctions dir as per https://github.com/alacritty/alacritty/blob/master/INSTALL.md#shell-completions
2021-01-25 08:24:13 +00:00
fpath+=${ZDOTDIR:-~}/.zsh_functions
2021-03-10 13:22:17 +00:00
# fzf configuration
2021-01-06 13:34:33 +00:00
export KEYTIMEOUT=2
2021-03-10 13:22:17 +00:00
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
2021-03-29 19:10:02 +00:00
# set up asdf
. $HOME/.asdf/asdf.sh