# vim bindings bindkey -v export KEYTIMEOUT=1 # Use vim cli mode bindkey '^P' up-history bindkey '^N' down-history # backspace and ^h working even after # returning from command mode bindkey '^?' backward-delete-char bindkey '^h' backward-delete-char # ctrl-w removed word backwards bindkey '^w' backward-kill-word # ctrl-r starts searching history backward bindkey '^r' history-incremental-search-backward if [ "light" = "$THEME_SWITCHER" ]; then ZSH_THEME="sunrise" else ZSH_THEME="agnoster" fi HIST_STAMPS="dd.mm.yyyy" COMPLETION_WAITING_DOTS="true" export EDITOR="vim" source $HOME/.dotfiles/zsh/aliases.zsh # fzf settings if type rg > /dev/null; then # Use ripgrep instead of find and exclude .gitignored files export FZF_DEFAULT_COMMAND='rg --files' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" _fzf_compgen_path() { rg --files "$1" } fi swth() { if [ "$THEME_SWITCHER" = "light" ]; then unset THEME_SWITCHER source ~/.zshrc else export THEME_SWITCHER="light" source ~/.zshrc fi } awscreds() { SSOFILE=~/.aws/sso/cache/$(\ls -t ~/.aws/sso/cache | head -n 1) CACHEFILE=~/.aws/cli/cache/$(\ls -t ~/.aws/cli/cache | head -n 1) export AWS_ACCESS_KEY_ID="$(jq -r '.Credentials.AccessKeyId' $CACHEFILE)" AWS_SECRET_ACCESS_KEY="$(jq -r '.Credentials.SecretAccessKey' $CACHEFILE)" export AWS_SESSION_TOKEN="$(jq -r '.Credentials.SessionToken' $SSOFILE)" } s3bat() { # create temporary folder filename=$(basename -- "$1") extension="${filename##*.}" path_hash=$(echo -n "$1" | sha256sum | head -c 64) tmpfile="/tmp/${path_hash}.${extension}" # check if tmpfile already exists if [[ ! -a "$tmpfile" ]]; then aws --profile backend s3 cp --request-payer requester $1 "$tmpfile" fi bat "$tmpfile" }