|
|
@ -1,113 +1,28 @@ |
|
|
|
#!/bin/zsh |
|
|
|
|
|
|
|
# System-wide profile for interactive zsh(1) shells. |
|
|
|
|
|
|
|
# Setup user specific overrides for this in ~/.zshrc. See zshbuiltins(1) |
|
|
|
# and zshoptions(1) for more details. |
|
|
|
|
|
|
|
# Correctly display UTF-8 with combining characters. |
|
|
|
if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then |
|
|
|
setopt COMBINING_CHARS |
|
|
|
fi |
|
|
|
|
|
|
|
export HOMEBREW_NO_AUTO_UPDATE=1 |
|
|
|
|
|
|
|
export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers" |
|
|
|
export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz" |
|
|
|
export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers" |
|
|
|
export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz" |
|
|
|
|
|
|
|
export CASE_SENSITIVE="true" |
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' |
|
|
|
|
|
|
|
export EDITOR=nvim |
|
|
|
export GIT_EDITOR=nvim |
|
|
|
|
|
|
|
export BROWSER=chromium |
|
|
|
|
|
|
|
# Disable the log builtin, so we don't conflict with /usr/bin/log |
|
|
|
disable log |
|
|
|
|
|
|
|
# Save command history |
|
|
|
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history |
|
|
|
HISTSIZE=99999999 |
|
|
|
SAVEHIST=$HISTSIZE |
|
|
|
|
|
|
|
# Beep on error |
|
|
|
setopt BEEP |
|
|
|
|
|
|
|
export PATH="~/.local/bin/:$PATH" |
|
|
|
export PATH="~/dotfiles/.local/bin/:$PATH" |
|
|
|
|
|
|
|
# Use keycodes (generated via zkbd) if present, otherwise fallback on |
|
|
|
# values from terminfo |
|
|
|
if [[ -r ${ZDOTDIR:-$HOME}/.zkbd/${TERM}-${VENDOR} ]] ; then |
|
|
|
source ${ZDOTDIR:-$HOME}/.zkbd/${TERM}-${VENDOR} |
|
|
|
else |
|
|
|
typeset -g -A key |
|
|
|
|
|
|
|
[[ -n "$terminfo[kf1]" ]] && key[F1]=$terminfo[kf1] |
|
|
|
[[ -n "$terminfo[kf2]" ]] && key[F2]=$terminfo[kf2] |
|
|
|
[[ -n "$terminfo[kf3]" ]] && key[F3]=$terminfo[kf3] |
|
|
|
[[ -n "$terminfo[kf4]" ]] && key[F4]=$terminfo[kf4] |
|
|
|
[[ -n "$terminfo[kf5]" ]] && key[F5]=$terminfo[kf5] |
|
|
|
[[ -n "$terminfo[kf6]" ]] && key[F6]=$terminfo[kf6] |
|
|
|
[[ -n "$terminfo[kf7]" ]] && key[F7]=$terminfo[kf7] |
|
|
|
[[ -n "$terminfo[kf8]" ]] && key[F8]=$terminfo[kf8] |
|
|
|
[[ -n "$terminfo[kf9]" ]] && key[F9]=$terminfo[kf9] |
|
|
|
[[ -n "$terminfo[kf10]" ]] && key[F10]=$terminfo[kf10] |
|
|
|
[[ -n "$terminfo[kf11]" ]] && key[F11]=$terminfo[kf11] |
|
|
|
[[ -n "$terminfo[kf12]" ]] && key[F12]=$terminfo[kf12] |
|
|
|
[[ -n "$terminfo[kf13]" ]] && key[F13]=$terminfo[kf13] |
|
|
|
[[ -n "$terminfo[kf14]" ]] && key[F14]=$terminfo[kf14] |
|
|
|
[[ -n "$terminfo[kf15]" ]] && key[F15]=$terminfo[kf15] |
|
|
|
[[ -n "$terminfo[kf16]" ]] && key[F16]=$terminfo[kf16] |
|
|
|
[[ -n "$terminfo[kf17]" ]] && key[F17]=$terminfo[kf17] |
|
|
|
[[ -n "$terminfo[kf18]" ]] && key[F18]=$terminfo[kf18] |
|
|
|
[[ -n "$terminfo[kf19]" ]] && key[F19]=$terminfo[kf19] |
|
|
|
[[ -n "$terminfo[kf20]" ]] && key[F20]=$terminfo[kf20] |
|
|
|
[[ -n "$terminfo[kbs]" ]] && key[Backspace]=$terminfo[kbs] |
|
|
|
[[ -n "$terminfo[kich1]" ]] && key[Insert]=$terminfo[kich1] |
|
|
|
[[ -n "$terminfo[kdch1]" ]] && key[Delete]=$terminfo[kdch1] |
|
|
|
[[ -n "$terminfo[khome]" ]] && key[Home]=$terminfo[khome] |
|
|
|
[[ -n "$terminfo[kend]" ]] && key[End]=$terminfo[kend] |
|
|
|
[[ -n "$terminfo[kpp]" ]] && key[PageUp]=$terminfo[kpp] |
|
|
|
[[ -n "$terminfo[knp]" ]] && key[PageDown]=$terminfo[knp] |
|
|
|
[[ -n "$terminfo[kcuu1]" ]] && key[Up]=$terminfo[kcuu1] |
|
|
|
[[ -n "$terminfo[kcub1]" ]] && key[Left]=$terminfo[kcub1] |
|
|
|
[[ -n "$terminfo[kcud1]" ]] && key[Down]=$terminfo[kcud1] |
|
|
|
[[ -n "$terminfo[kcuf1]" ]] && key[Right]=$terminfo[kcuf1] |
|
|
|
fi |
|
|
|
|
|
|
|
# Default key bindings |
|
|
|
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char |
|
|
|
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line |
|
|
|
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line |
|
|
|
[[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search |
|
|
|
[[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search |
|
|
|
export CASE_SENSITIVE="true" |
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' |
|
|
|
|
|
|
|
autoload -U colors && colors # Load colors |
|
|
|
# Load colors |
|
|
|
PROMPT="%{$fg[blue]%}%1~ %{$fg[green]%}>%{$reset_color%} " |
|
|
|
|
|
|
|
setopt autocd # Automatically cd into typed directory. |
|
|
|
# Automatically cd into typed directory. |
|
|
|
setopt autocd |
|
|
|
|
|
|
|
# Useful support for interacting with Terminal.app or other terminal programs |
|
|
|
[ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM" |
|
|
|
|
|
|
|
# Load aliases |
|
|
|
source ~/.config/aliasrc |
|
|
|
|
|
|
|
# Load Git completion |
|
|
|
zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash |
|
|
|
fpath=(~/.zsh $fpath) |
|
|
|
|
|
|
|
# Basic auto/tab complete: |
|
|
|
autoload -U compinit |
|
|
|
zstyle ':completion:*' menu select |
|
|
|
zmodload zsh/complist |
|
|
|
compinit |
|
|
|
_comp_options+=(globdots) # Include hidden files. |
|
|
|
|
|
|
|
# vi mode |
|
|
|
bindkey -v |
|
|
|
export KEYTIMEOUT=1 |
|
|
@ -119,66 +34,15 @@ bindkey -M menuselect 'l' vi-forward-char |
|
|
|
bindkey -M menuselect 'j' vi-down-line-or-history |
|
|
|
bindkey -v '^?' backward-delete-char |
|
|
|
|
|
|
|
# Change cursor shape for different vi modes. |
|
|
|
function zle-keymap-select { |
|
|
|
if [[ ${KEYMAP} == vicmd ]] || |
|
|
|
[[ $1 = 'block' ]]; then |
|
|
|
echo -ne '\e[1 q' |
|
|
|
elif [[ ${KEYMAP} == main ]] || |
|
|
|
[[ ${KEYMAP} == viins ]] || |
|
|
|
[[ ${KEYMAP} = '' ]] || |
|
|
|
[[ $1 = 'beam' ]]; then |
|
|
|
echo -ne '\e[5 q' |
|
|
|
fi |
|
|
|
} |
|
|
|
zle -N zle-keymap-select |
|
|
|
zle-line-init() { |
|
|
|
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) |
|
|
|
echo -ne "\e[5 q" |
|
|
|
} |
|
|
|
zle -N zle-line-init |
|
|
|
echo -ne '\e[5 q' # Use beam shape cursor on startup. |
|
|
|
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. |
|
|
|
|
|
|
|
bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n' |
|
|
|
|
|
|
|
# Edit line in vim with ctrl-e: |
|
|
|
autoload edit-command-line; zle -N edit-command-line |
|
|
|
bindkey '^e' edit-command-line |
|
|
|
|
|
|
|
# Load syntax highlighting; should be last. |
|
|
|
source ~/.zsh/fsh/fast-syntax-highlighting.plugin.zsh 2>/dev/null |
|
|
|
|
|
|
|
|
|
|
|
# Go up directory structures |
|
|
|
up () { |
|
|
|
cd $(printf "%0.0s../" $(seq 1 $1)); |
|
|
|
} |
|
|
|
|
|
|
|
git-prune () { |
|
|
|
if [[ $@ == "--apply" ]]; then |
|
|
|
command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d |
|
|
|
else |
|
|
|
command git branch --merged develop | grep -vEw "develop$|master$" |
|
|
|
fi |
|
|
|
cd $(printf "%0.0s../" $(seq 1 $1)); |
|
|
|
} |
|
|
|
|
|
|
|
mkcd () { |
|
|
|
mkdir -p $@ && cd $@ |
|
|
|
} |
|
|
|
|
|
|
|
# Use lf to switch directories and bind it to ctrl-o |
|
|
|
lfcd () { |
|
|
|
tmp="$(mktemp)" |
|
|
|
lfpreview -last-dir-path="$tmp" "$@" |
|
|
|
if [ -f "$tmp" ]; then |
|
|
|
dir="$(cat "$tmp")" |
|
|
|
rm -f "$tmp" >/dev/null |
|
|
|
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" |
|
|
|
fi |
|
|
|
} |
|
|
|
bindkey -s '^o' 'lfcd\n' |
|
|
|
|
|
|
|
function cdv () { |
|
|
|
if [[ $(uname) == 'Darwin' ]]; then |
|
|
|
cd $(pbpaste) |
|
|
@ -192,25 +56,32 @@ function cdf () { |
|
|
|
cd $(find . -type d -print | fzf) |
|
|
|
} |
|
|
|
|
|
|
|
export PATH="/usr/local/opt/php@7.4/bin:$PATH" |
|
|
|
export PATH="/usr/local/opt/php@7.4/sbin:$PATH" |
|
|
|
# Load aliases |
|
|
|
source ~/.config/aliasrc |
|
|
|
|
|
|
|
export EDITOR=nvim |
|
|
|
export GIT_EDITOR=nvim |
|
|
|
|
|
|
|
# Save command history |
|
|
|
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history |
|
|
|
HISTSIZE=99999999 |
|
|
|
SAVEHIST=$HISTSIZE |
|
|
|
|
|
|
|
export PATH="~/.local/bin/:$PATH" |
|
|
|
|
|
|
|
if [[ $(uname) == 'Darwin' ]]; then |
|
|
|
export PATH="/opt/homebrew/lib/ruby/gems/3.3.0:$PATH" |
|
|
|
export PATH="/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0:$PATH" |
|
|
|
fi |
|
|
|
|
|
|
|
export LESS='-R' |
|
|
|
export LESSOPEN='|~/.lessfilter %s' |
|
|
|
export ANDROID_HOME="$HOME/Android/Sdk" |
|
|
|
|
|
|
|
export ANDROID_HOME=$HOME/Android/Sdk |
|
|
|
if [[ $(uname) == 'Darwin' ]]; then |
|
|
|
export ANDROID_HOME=$HOME/Library/Android/sdk |
|
|
|
export ANDROID_HOME="$HOME/Library/Android/sdk" |
|
|
|
export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" |
|
|
|
fi |
|
|
|
export PATH=$PATH:$ANDROID_HOME/platform-tools |
|
|
|
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin |
|
|
|
|
|
|
|
export PATH="${PATH}:${ANDROID_HOME}/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin" |
|
|
|
|
|
|
|
# FNM variables |
|
|
|
export PATH="/run/user/1000/fnm_multishells/20590_1663546026606/bin":$PATH |
|
|
|
export FNM_MULTISHELL_PATH="/run/user/1000/fnm_multishells/20590_1663546026606" |
|
|
|
export FNM_VERSION_FILE_STRATEGY="local" |
|
|
@ -223,5 +94,10 @@ rehash |
|
|
|
export PHPCS_STANDARD=~/.config/phpcs.xml |
|
|
|
|
|
|
|
if [[ $(uname) == 'Darwin' ]]; then |
|
|
|
export HOMEBREW_NO_AUTO_UPDATE=1 |
|
|
|
|
|
|
|
export PATH="/opt/homebrew/lib/ruby/gems/3.3.0:$PATH" |
|
|
|
export PATH="/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0:$PATH" |
|
|
|
|
|
|
|
eval "$(rbenv init - zsh)" |
|
|
|
fi |