minimize zshrc

This commit is contained in:
Christoph J. Scherr 2023-09-13 21:04:37 +02:00
parent 46294adcac
commit 8b468fef5f
1 changed files with 4 additions and 51 deletions

55
.zshrc
View File

@ -8,20 +8,17 @@ export TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
export ZSH=$HOME/.zsh
### Aliases
alias l="lsd -lah"
alias ll="lsd -lh"
alias la="lsd -a"
alias ls="lsd"
alias l="ls -lah"
alias ll="ls -lh"
alias la="ls -a"
alias ls="ls"
alias grep="grep --color"
alias egrep="grep -E"
alias lgrep="find | grep"
alias psgrep="ps axu | grep"
alias plasmarestart="killall plasmashell; kstart5 plasmashell"
alias isotime='date +"%Y-%m-%dT%H:%M:%S%z"'
alias gg=lazygit
alias reload="source ~/.zshrc"
alias gls=/bin/ls
alias neorg='nvim -c "Neorg workspace $1"'
### non standard aliases
if [ -f ~/.zsh_aliases ]; then
@ -32,14 +29,9 @@ fi
function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\s" }
function midfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(M|G|T|P|E)\s" }
function smallfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(B|K)\s" }
function cachekeys () { exec 2>/dev/null;
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
}
function newpass() {
LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c${1:-$0}
}
# TODO: make neorg a function, take a workspace as arg
### ---- zsh options -------------------------------------
setopt autocd
@ -101,7 +93,6 @@ bindkey '^M' expand-dots-then-accept-line
PS1='%B%F{red}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k'
### ---- ZSH MODULES -----------------------------------
fpath=($ZSH/zfunc $fpath)
# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
@ -145,41 +136,3 @@ if [ -x /usr/bin/dircolors ]; then
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
fi
### ---- PLUGINS -----------------------------------
source $ZSH/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source $ZSH/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.local/share/fzf/key-bindings.zsh
source ~/.local/share/fzf/completion.zsh
fpath=($ZSH/plugins/zsh-completions/src $fpath)
### --- fzf Config ------------------------------------
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
export FZF_CTRL_R_OPTS='--no-sort --exact'
### --- nnn Config ------------------------------------
source ~/.local/share/nnn/quitcd/quitcd.bash_zsh
export NNN_PLUG='j:jump;z:autojump;'
### --- kitty Config ------------------------------------
# $KITTY_TERM is a custom envar I set in the kitty conf
# this stuff does not work nicely with tmux, just make them regular aliases. Shows an error if you use them in another terminal
#if [[ "$KITTY_TERM" -eq "TRUE" ]]
#then
# alias ssh="kitty +kitten ssh"
# alias tmux="export KITTY_TERM='TRUE'; tmux"
#fi
alias kssh="kitty +kitten ssh"
alias kimg="kitty +kitten icat"
# kdiff does not work on my system for some reason
#alias kdiff="kitty +kitten diff"
### --- zoxide Config ------------------------------------
if ! command -v zoxide &> /dev/null
then
# zoxide not installed, skipping
# do nothing
else
eval "$(zoxide init zsh)"
fi