193 lines
5 KiB
Plaintext
193 lines
5 KiB
Plaintext
export DISABLE_AUTO_TITLE="true"
|
|
|
|
# Path to your oh-my-zsh installation.
|
|
export ZSH=$HOME/.oh-my-zsh
|
|
export UPDATE_ZSH_DAYS=128
|
|
|
|
# Look in ~/.oh-my-zsh/themes/
|
|
ZSH_THEME="mh"
|
|
|
|
# Uncomment the following line to disable bi-weekly auto-update checks.
|
|
# DISABLE_AUTO_UPDATE="true"
|
|
|
|
# Uncomment the following line to display red dots whilst waiting for completion.
|
|
COMPLETION_WAITING_DOTS="true"
|
|
|
|
# Uncomment the following line if you want to disable marking untracked files
|
|
# under VCS as dirty. This makes repository status check for large repositories
|
|
# much, much faster.
|
|
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
|
|
# Uncomment the following line if you want to change the command execution time
|
|
# stamp shown in the history command output.
|
|
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
|
# HIST_STAMPS="mm/dd/yyyy"
|
|
|
|
plugins=(history-substring-search nix-shell)
|
|
|
|
export NIXPKGS_ALLOW_UNFREE=1
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
# Load local zshrc if it exists
|
|
if [[ -a ~/.zshrc-local ]]; then
|
|
source ~/.zshrc-local
|
|
fi
|
|
|
|
export PATH="$PATH:$HOME/.bin"
|
|
export PATH="$PATH:/usr/local/bin"
|
|
|
|
export EDITOR='nvim'
|
|
|
|
export FZF_DEFAULT_COMMAND='rg --files'
|
|
|
|
export LS_COLORS="di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
|
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
|
|
|
# Setup the prompt
|
|
if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi
|
|
|
|
if [[ -n $SSH_CONNECTION ]]; then
|
|
export PROMPT='[%{$fg[$NCOLOR]%}%B%n%b@%F{green}%m%f%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) '
|
|
else
|
|
if [[ -z "${IN_NIX_SHELL}" ]]; then PSTAR=""; else PSTAR="*" fi
|
|
export PROMPT='[${PSTAR}%{$fg[$NCOLOR]%}%B${NIX_PICK_NAME:-%n}%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) '
|
|
fi
|
|
|
|
# Vi mode
|
|
bindkey -v
|
|
|
|
autoload -z edit-command-line
|
|
zle -N edit-command-line
|
|
bindkey "^E" edit-command-line
|
|
|
|
# Visual indication of mode
|
|
function zle-line-init zle-keymap-select {
|
|
VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
|
|
RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
|
|
zle reset-prompt
|
|
}
|
|
|
|
zle -N zle-line-init
|
|
zle -N zle-keymap-select
|
|
|
|
# GOTTA GO FAST!
|
|
export KEYTIMEOUT=1
|
|
|
|
function fine { find . -name "*$1*" }
|
|
|
|
# Disable the thing where typing a directory name cds into it
|
|
unsetopt AUTO_CD
|
|
|
|
alias jpp="pbpaste | python -m json.tool"
|
|
alias dc="docker-compose"
|
|
alias icat="kitty +kitten icat"
|
|
alias vi=nvim
|
|
alias cm=chezmoi
|
|
alias cme="chezmoi edit"
|
|
|
|
gsel() {
|
|
grep --color=always -r $@ | sel -p'^([^:]*):.*'
|
|
}
|
|
|
|
vims() {
|
|
kitty @ launch --type os-window --copy-env --cwd current nvim --listen ~/.cache/nvim/server.pipe > /dev/null
|
|
}
|
|
|
|
vimc() {
|
|
nvim --server ~/.cache/nvim/server.pipe --remote-send '<ESC>:vsplit<CR>'
|
|
nvim --server ~/.cache/nvim/server.pipe --remote "$(realpath $@)"
|
|
}
|
|
|
|
vcd() {
|
|
nvim --server ~/.cache/nvim/server.pipe --remote-send '<ESC>:cd $(pwd)<CR>'
|
|
}
|
|
|
|
op() {
|
|
local IFS=$'\n'
|
|
if [ $# -eq 0 ]; then
|
|
lines=($(fzf --tiebreak=end --print-query --preview 'ptf {}'))
|
|
else
|
|
lines=($(fzf --tiebreak=end --print-query --preview 'ptf {}' --query $@))
|
|
fi;
|
|
|
|
if [ $? -eq 0 ];
|
|
then
|
|
final_query=$lines[1]
|
|
fname=$lines[2]
|
|
print -s "vimc $final_query";
|
|
print -s "vimc $fname";
|
|
vimc $fname;
|
|
fi;
|
|
}
|
|
if command -v pyenv 1>/dev/null 2>&1; then
|
|
eval "$(pyenv init -)"
|
|
fi
|
|
|
|
gnb() {
|
|
git fetch
|
|
git checkout --no-track -b $1 "origin/$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"
|
|
git branch -u "origin/$1"
|
|
}
|
|
|
|
function prg() {
|
|
\rg --heading --color=always $@ | less -F
|
|
}
|
|
|
|
alias rg='prg'
|
|
alias gpnv='git push --set-upstream origin $(git branch --show-current) --no-verify'
|
|
alias gcnv='git commit --no-verify'
|
|
alias xc='xclip -selection clipboard'
|
|
alias xp='xclip -o'
|
|
alias vol='pactl set-sink-volume @DEFAULT_SINK@'
|
|
|
|
# "nix-pick"
|
|
function nix-pick {
|
|
nix-shell ~/.config/nix-pick/$1.nix
|
|
}
|
|
function _nix-pick {
|
|
_arguments "1: :($(ls ~/.config/nix-pick | sed 's/^\(.*\).nix$/\1/g' | xargs echo -n))"
|
|
}
|
|
|
|
compdef _nix-pick nix-pick
|
|
|
|
alias np=nix-pick
|
|
alias ,="nix-shell -p"
|
|
|
|
alias config='git --git-dir=$HOME/.othello/ --work-tree=/'
|
|
alias qute-recover='vi "/tmp/$(ls -t /tmp | grep "qutebrowser-editor" | fzf --preview '"'"'cat /tmp/{} | fold -w $FZF_PREVIEW_COLUMNS'"'"')"'
|
|
|
|
function killall {
|
|
kargs=( "$@" )
|
|
kargs[1]=()
|
|
procs=$(ps aux | grep $1 | grep -v grep)
|
|
echo "Found the following processes:"
|
|
echo "================================================================================"
|
|
echo $procs
|
|
echo "================================================================================"
|
|
echo "Do you want to kill all $(echo $procs | wc -l) process(es)? [yN] "
|
|
|
|
read
|
|
echo $REPLY
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
then
|
|
echo $procs | awk '{ print $2 }' | xargs kill $kargs
|
|
else
|
|
echo "Bailing."
|
|
fi
|
|
}
|
|
|
|
function bcd {
|
|
if [ -z $1 ]; then;
|
|
cd "/home/lanny/bstock/$(ls ~/bstock | fzf)"
|
|
else
|
|
cd ~/bstock/$1
|
|
fi
|
|
}
|
|
function _bcd {
|
|
_arguments "1: :($(ls ~/bstock | xargs echo -n))"
|
|
}
|
|
compdef _bcd bcd
|
|
|
|
alias gbpick='git checkout $(git branch | awk '"'"'{$1=$1; print}'"'"' | fzf)'
|