2021-02-13 11:28:59 -05:00
|
|
|
# __________
|
|
|
|
# ___ ____/_________ __
|
|
|
|
# __ __/ __ __ \_ | / /
|
|
|
|
# _ /___ _ / / /_ |/ /
|
|
|
|
# /_____/ /_/ /_/_____/
|
|
|
|
#
|
|
|
|
# XDG thingy
|
|
|
|
export XDG_CONFIG_HOME=$HOME/.config
|
|
|
|
export XDG_CACHE_HOME=$HOME/.cache
|
|
|
|
export XDG_DATA_HOME=$HOME/.local/share
|
|
|
|
export XDG_DATA_DIRS=$HOME/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
|
|
|
|
# alternate paths
|
|
|
|
export BASH_COMPLETION_USER_DIR="$XDG_DATA_HOME/bash"
|
2021-05-02 19:12:01 -04:00
|
|
|
export HISTFILE="$BASH_COMPLETION_USER_DIR/bash_history"
|
2021-02-13 11:28:59 -05:00
|
|
|
export LESSHISTFILE=-
|
|
|
|
export MOST_INITFILE=$XDG_CONFIG_HOME/mostrc
|
|
|
|
export GTK2_RC_FILES=$XDG_CONFIG_HOME/gtk-2.0/gtkrc
|
|
|
|
export TERMINFO="$XDG_DATA_HOME/terminfo"
|
|
|
|
export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:/usr/share/terminfo"
|
|
|
|
export GOPATH=$XDG_DATA_HOME/go
|
|
|
|
export GRADLE_USER_HOME=$XDG_DATA_HOME/gradle
|
|
|
|
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java
|
|
|
|
export NODE_REPL_HISTORY=$XDG_CACHE_HOME/node_repl_history
|
|
|
|
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
|
|
|
|
export NPM_CONFIG_PREFIX="$XDG_DATA_HOME/npm-global"
|
|
|
|
export CARGO_HOME=$XDG_DATA_HOME/cargo
|
|
|
|
export RUSTUP_HOME=$XDG_DATA_HOME/rustup
|
|
|
|
export BUNDLE_USER_CONFIG=$XDG_CONFIG_HOME/bundle
|
|
|
|
export BUNDLE_USER_CACHE=$XDG_CACHE_HOME/bundle
|
|
|
|
export BUNDLE_USER_PLUGIN=$XDG_DATA_HOME/bundle
|
|
|
|
export GEM_HOME=$XDG_DATA_HOME/gem
|
|
|
|
export GEM_SPEC_CACHE=$XDG_CACHE_HOME/gem
|
|
|
|
export DOCKER_CONFIG=$XDG_CONFIG_HOME/docker
|
|
|
|
export GNUPGHOME=$XDG_DATA_HOME/gnupg
|
|
|
|
export JUPYTER_CONFIG_DIR=$XDG_CONFIG_HOME/jupyter
|
|
|
|
export IPYTHONDIR=$XDG_CONFIG_HOME/ipython
|
|
|
|
export XAUTHORITY=$XDG_RUNTIME_DIR/Xauthority
|
|
|
|
export XINITRC=$XDG_CONFIG_HOME/X11/xinitrc
|
|
|
|
export XSERVERRC=$XDG_CONFIG_HOME/X11/xserverrc
|
2021-04-17 08:40:45 -04:00
|
|
|
export WGETRC=$XDG_CONFIG_HOME/wget/wgetrc
|
2021-05-19 17:52:46 -04:00
|
|
|
export WEECHAT_HOME=$XDG_CONFIG_HOME/weechat
|
2021-02-13 11:28:59 -05:00
|
|
|
|
|
|
|
# env
|
2021-03-13 23:47:45 -05:00
|
|
|
export PAGER="less -R"
|
2021-02-13 11:28:59 -05:00
|
|
|
export VISUAL=nvim
|
|
|
|
export EDITOR=nvim
|
|
|
|
export SVDIR=$HOME/.local/share/service
|
|
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
|
|
export GPG_TTY="$(tty)"
|
|
|
|
# pfetch
|
|
|
|
export PF_INFO="ascii title kernel wm shell uptime pkgs memory"
|
|
|
|
# fzf
|
|
|
|
export FZF_DEFAULT_OPTS="--multi --layout=reverse --inline-info
|
|
|
|
--color fg:#D8DEE9,bg:#2E3440,hl:#A3BE8C,fg+:#D8DEE9,bg+:#434C5E,hl+:#A3BE8C
|
|
|
|
--color pointer:#BF616A,info:#4C566A,spinner:#4C566A,header:#4C566A,prompt:#81A1C1,marker:#EBCB8B"
|
|
|
|
# export FZF_DEFAULT_OPTS="--multi --layout=reverse --inline-info
|
|
|
|
# --color dark
|
|
|
|
# --color fg:-1,bg:-1,hl:#c678dd,fg+:#ffffff,bg+:#4b5263,hl+:#d858fe
|
|
|
|
# --color info:#98c379,prompt:#61afef,pointer:#be5046,marker:#e5c07b,spinner:#61afef,header:#61afef"
|
|
|
|
export FZF_DEFAULT_COMMAND="fd --type f --follow --hidden --exclude .git"
|
|
|
|
export FZF_CTRL_T_OPTS="--no-height --preview-window 'left:60%' --preview '$HOME/.local/bin/garbage/preview {} 2>/dev/null'"
|
|
|
|
export FZF_CTRL_T_COMMAND="fd --follow --hidden --exclude .git"
|
2021-04-03 14:28:33 -04:00
|
|
|
export FZF_ALT_C_OPTS="--preview 'exa -1a --sort=type --color always --icons {} 2>/dev/null'"
|
2021-02-13 11:28:59 -05:00
|
|
|
export FZF_ALT_C_COMMAND="fd --type d --follow --hidden --exclude .git"
|
|
|
|
export FZF_TMUX=1
|
|
|
|
# ibus
|
|
|
|
export GTK_IM_MODULE=ibus
|
|
|
|
export XMODIFIERS=@im=ibus
|
|
|
|
export QT_IM_MODULE=ibus
|
|
|
|
# qt5ct
|
|
|
|
export QT_QPA_PLATFORMTHEME=qt5ct
|
|
|
|
export QT_PLATFORM_PLUGIN=qt5ct
|
|
|
|
# .NET
|
|
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
2021-03-08 16:18:17 -05:00
|
|
|
# zoxide
|
|
|
|
export _ZO_DATA_DIR="$HOME/.local/share/zoxide"
|
|
|
|
export _ZO_ECHO=1
|
2021-03-08 16:37:59 -05:00
|
|
|
export _ZO_FZF_OPTS="$FZF_DEFAULT_OPTS --no-multi"
|
2021-03-08 16:18:17 -05:00
|
|
|
export _ZO_RESOLVE_SYMLINKS=1
|
2021-02-13 11:28:59 -05:00
|
|
|
# z.lua
|
2021-03-08 16:18:17 -05:00
|
|
|
# export _ZL_DATA="$HOME/.local/share/zlua/zlua"
|
|
|
|
# export _ZL_HYPHEN=1
|
2021-03-08 16:37:59 -05:00
|
|
|
# export _ZL_ECHO=1
|
2021-03-08 16:18:17 -05:00
|
|
|
# export _ZL_MATCH_MODE=1
|
2021-03-08 16:37:59 -05:00
|
|
|
# export _ZL_FZF_FLAG="--exact --no-multi"
|
2021-03-08 16:18:17 -05:00
|
|
|
# export _ZL_INT_SORT=1
|
|
|
|
# export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro"
|
|
|
|
# export RANGER_ZLUA="$HOME/.local/share/bash/z.lua"
|
2021-02-13 11:28:59 -05:00
|
|
|
# nodenv
|
|
|
|
export NODENV_ROOT="$HOME/.local/share/nodenv"
|
|
|
|
# pyenv
|
|
|
|
export PYENV_ROOT="$HOME/.local/share/pyenv"
|
|
|
|
# poetry
|
|
|
|
export POETRY_HOME="$HOME/.local/share/poetry"
|
2021-05-08 15:42:09 -04:00
|
|
|
# cht.sh
|
|
|
|
export CHTSH="$XDG_CONFIG_HOME/cht.sh"
|
2021-02-13 11:28:59 -05:00
|
|
|
# nnn
|
|
|
|
if command -v nnn >/dev/null
|
|
|
|
then
|
|
|
|
export TERMINAL=alacritty # for the preview script
|
2021-03-22 15:54:22 -04:00
|
|
|
export NNN_OPTS="HUedx"
|
2021-03-29 10:49:29 -04:00
|
|
|
export NNN_PLUG='b:bulknew;c:fzcd;o:fzopen;z:fzz;d:gpgd;e:gpge;h:hexview;m:nmount;n:nuke;t:preview-tui;r:renamer;p:rsynccp;j:splitjoin;s:suedit;i:ringtone'
|
2021-02-13 11:28:59 -05:00
|
|
|
export NNN_FIFO="/tmp/nnn.fifo"
|
|
|
|
export NNN_ARCHIVE='\\.(7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)$'
|
2021-03-18 09:56:56 -04:00
|
|
|
# export NNN_OPENER="$XDG_CONFIG_HOME/nnn/plugins/nuke"
|
2021-03-18 16:05:25 -04:00
|
|
|
# export NNN_TRASH=1 # Use trash-cli
|
2021-02-13 11:28:59 -05:00
|
|
|
export USE_SCOPE=1
|
|
|
|
export NNN_COLORS='2345'
|
2021-03-29 10:49:29 -04:00
|
|
|
export NNN_FCOLORS='c1e20402006006f7c6d6ab01'
|
2021-04-03 15:15:33 -04:00
|
|
|
export NNN_BMS="h:~;C:~/Code;D:~/Downloads;P:~/Pictures;V:~/Videos;A:~/Media;U:~/Music;f:~/.config;l:~/.local/share;e:/etc;u:/usr/share;o:/opt;b:/boot;m:/media;M:/mnt;i:/run/media/$USER;v:/var;t:/tmp;d:/dev;s:/srv;r:/"
|
2021-02-13 11:28:59 -05:00
|
|
|
export NNN_SSHFS="sshfs -o reconnect,idmap=user,follow_symlinks"
|
|
|
|
fi
|
|
|
|
# lf
|
|
|
|
if command -v lf >/dev/null
|
|
|
|
then
|
|
|
|
export LF_ICONS="\
|
|
|
|
tw=:\
|
|
|
|
st=:\
|
|
|
|
ow=:\
|
|
|
|
dt=:\
|
|
|
|
di=:\
|
|
|
|
fi=:\
|
|
|
|
ln=:\
|
|
|
|
or=:\
|
|
|
|
ex=:\
|
|
|
|
*.7z=:\
|
|
|
|
*.a=:\
|
|
|
|
*.ace=:\
|
|
|
|
*.alz=:\
|
|
|
|
*.ai=:\
|
|
|
|
*.apk=:\
|
|
|
|
*.arc=:\
|
|
|
|
*.arj=:\
|
|
|
|
*.asm=:\
|
|
|
|
*.asp=:\
|
|
|
|
*.aup=:\
|
|
|
|
*.avi=:\
|
|
|
|
*.awk=:\
|
|
|
|
*.bash=:\
|
|
|
|
*.bat=:\
|
|
|
|
*.bmp=:\
|
|
|
|
*.bz=:\
|
|
|
|
*.bz2=:\
|
|
|
|
*.c=:\
|
|
|
|
*.c++=:\
|
|
|
|
*.cab=:\
|
|
|
|
*.cbr=:\
|
|
|
|
*.cbz=:\
|
|
|
|
*.cc=:\
|
|
|
|
*.class=:\
|
|
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
|
|
*.vob=:\
|
|
|
|
*.vue=﵂:\
|
|
|
|
*.wav=:\
|
|
|
|
*.war=:\
|
|
|
|
*.webm=:\
|
|
|
|
*.webmanifest=:\
|
|
|
|
*.webp=:\
|
|
|
|
*.wim=:\
|
|
|
|
*.xbm=:\
|
|
|
|
*.xbps=:\
|
|
|
|
*.xcplayground=:\
|
|
|
|
*.xhtml=:\
|
|
|
|
*.xls=:\
|
|
|
|
*.xlsx=:\
|
|
|
|
*.xml=:\
|
|
|
|
*.xpm=:\
|
|
|
|
*.xul=:\
|
|
|
|
*.xz=:\
|
|
|
|
*.yaml=:\
|
|
|
|
*.yml=:\
|
|
|
|
*.z=:\
|
|
|
|
*.zip=:\
|
|
|
|
*.zoo=:\
|
|
|
|
*.zsh=:\
|
|
|
|
*.zip=:\
|
|
|
|
*.zst=:\
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# _________________
|
|
|
|
# ___ |__ /__(_)_____ ________
|
|
|
|
# __ /| |_ /__ /_ __ `/_ ___/
|
|
|
|
# _ ___ | / _ / / /_/ /_(__ )
|
|
|
|
# /_/ |_/_/ /_/ \__,_/ /____/
|
|
|
|
#
|
|
|
|
# remap
|
|
|
|
alias p="pulsemixer"
|
|
|
|
alias ls="exa -lF --icons --sort=type"
|
|
|
|
alias la="exa -laF --icons --sort=type"
|
|
|
|
alias lt="exa --tree"
|
|
|
|
alias cp="cp -vir"
|
2021-02-20 11:13:12 -05:00
|
|
|
alias mv="mv -vi"
|
2021-02-13 11:28:59 -05:00
|
|
|
alias rm="rm -vr"
|
|
|
|
alias mkdir="mkdir -pv"
|
|
|
|
alias no="grep -viP"
|
|
|
|
alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
|
|
|
|
alias tmux="TERM=screen-256color tmux"
|
|
|
|
alias startx="startx $HOME/.config/X11/xinitrc"
|
|
|
|
alias fehwpp="feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/*"
|
|
|
|
# colorizing
|
|
|
|
alias grep="grep --color=auto"
|
|
|
|
alias fgrep="fgrep --color=auto"
|
|
|
|
alias egrep="egrep --color=auto"
|
|
|
|
alias diff="diff --color=auto"
|
|
|
|
alias ncdu="ncdu --color=dark"
|
|
|
|
alias ip="ip -color=always"
|
|
|
|
# vim
|
|
|
|
alias v="nvim"
|
2021-03-22 16:13:53 -04:00
|
|
|
alias vi='fzf | xargs -r nvim -o'
|
2021-02-13 11:28:59 -05:00
|
|
|
# emacs
|
2021-05-25 09:39:15 -04:00
|
|
|
alias doom="$HOME/.config/emacs-config/doom/bin/doom"
|
2021-02-13 11:28:59 -05:00
|
|
|
alias e="emacs -nw"
|
2021-02-14 15:59:55 -05:00
|
|
|
alias em="emacsclient -c -a 'emacs'"
|
2021-02-13 11:28:59 -05:00
|
|
|
# rsync
|
2021-05-01 13:03:07 -04:00
|
|
|
alias rsyncdir="rsync -avP --delete-after"
|
2021-02-13 11:28:59 -05:00
|
|
|
# youtube-dl
|
|
|
|
alias yoump3="youtube-dl --extract-audio --audio-format mp3 --embed-thumbnail"
|
|
|
|
alias youflac="youtube-dl --extract-audio --audio-format flac"
|
2021-06-05 15:00:25 -04:00
|
|
|
alias youlist="youtube-dl --yes-playlist"
|
2021-02-13 11:28:59 -05:00
|
|
|
|
|
|
|
# Lazy cd-ing
|
|
|
|
alias ..='cd ..'
|
|
|
|
alias ...='cd ../..'
|
|
|
|
alias ....='cd ../../..'
|
|
|
|
|
|
|
|
# colorize man pages
|
|
|
|
man() {
|
2021-05-06 11:11:51 -04:00
|
|
|
MANPATH=$HOME/.local/share/man:$MANPATH \
|
2021-02-13 11:28:59 -05:00
|
|
|
LESS_TERMCAP_mb=$'\e[01;31m' \
|
|
|
|
LESS_TERMCAP_md=$'\e[01;36m' \
|
|
|
|
LESS_TERMCAP_me=$'\e[0m' \
|
|
|
|
LESS_TERMCAP_se=$'\e[0m' \
|
|
|
|
LESS_TERMCAP_so=$'\e[01;44;33m' \
|
|
|
|
LESS_TERMCAP_ue=$'\e[0m' \
|
|
|
|
LESS_TERMCAP_us=$'\e[01;32m' \
|
|
|
|
command man $@
|
|
|
|
}
|
|
|
|
|
|
|
|
alias x=extract
|
|
|
|
extract() {
|
|
|
|
local remove_archive
|
|
|
|
local success
|
|
|
|
local extract_dir
|
|
|
|
|
|
|
|
if (( $# == 0 )); then
|
|
|
|
cat <<-'EOF' >&2
|
|
|
|
Usage: extract [-option] [file ...]
|
|
|
|
Options:
|
|
|
|
-r, --remove Remove archive after unpacking.
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
remove_archive=1
|
|
|
|
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
|
|
|
remove_archive=0
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
while (( $# > 0 )); do
|
|
|
|
if [[ ! -f "$1" ]]; then
|
|
|
|
echo "extract: '$1' is not a valid file" >&2
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
success=0
|
|
|
|
extract_dir="${1:t:r}"
|
|
|
|
case "${1:l}" in
|
|
|
|
*.tar.gz|*.tgz) tar zxvf "$1" ;;
|
|
|
|
*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
|
|
|
*.tar.xz|*.txz)
|
|
|
|
tar --xz -xvf "$1" || xzcat "$1" | tar xvf - ;;
|
|
|
|
*.tar.zma|*.tlz)
|
|
|
|
tar --lzma -xvf "$1" || lzcat "$1" | tar xvf - ;;
|
|
|
|
*.tar.zst|*.tzst)
|
|
|
|
tar --zstd -xvf "$1" || zstdcat "$1" | tar xvf - ;;
|
|
|
|
*.tar) tar xvf "$1" ;;
|
|
|
|
*.tar.lz) tar xvf "$1" ;;
|
|
|
|
*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
|
|
|
|
*.tar.lrz) lrzuntar "$1" ;;
|
|
|
|
*.gz) gunzip -k "$1" ;;
|
|
|
|
*.bz2) bunzip2 "$1" ;;
|
|
|
|
*.xz) unxz "$1" ;;
|
|
|
|
*.lrz) lrunzip "$1" ;;
|
|
|
|
*.lz4) lz4 -d "$1" ;;
|
|
|
|
*.lzma) unlzma "$1" ;;
|
|
|
|
*.z) uncompress "$1" ;;
|
|
|
|
*.zip|*.war|*.jar|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;;
|
|
|
|
*.rar) unrar x -ad "$1" ;;
|
|
|
|
*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
|
|
|
|
*.7z) 7za x "$1" ;;
|
|
|
|
*.deb)
|
|
|
|
mkdir -p "$extract_dir/control"
|
|
|
|
mkdir -p "$extract_dir/data"
|
|
|
|
cd "$extract_dir"; ar vx "../${1}" > /dev/null
|
|
|
|
cd control; tar xzvf ../control.tar.gz
|
|
|
|
cd ../data; extract ../data.tar.*
|
|
|
|
cd ..; rm *.tar.* debian-binary
|
|
|
|
cd ..
|
|
|
|
;;
|
|
|
|
*.zst) unzstd "$1" ;;
|
|
|
|
*)
|
|
|
|
echo "extract: '$1' cannot be extracted" >&2
|
|
|
|
success=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
(( success = $success > 0 ? $success : $? ))
|
|
|
|
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# nnn with cd on quit
|
2021-03-08 16:18:17 -05:00
|
|
|
if command -v nnn >/dev/null; then
|
|
|
|
alias ncp="cat ${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | tr '\0' '\n'"
|
2021-02-13 11:28:59 -05:00
|
|
|
|
2021-03-08 16:18:17 -05:00
|
|
|
n () {
|
|
|
|
# Block nesting of nnn in subshells
|
|
|
|
if [[ -n $NNNLVL ]] && [ "${NNNLVL:-0}" -ge 1 ]; then
|
|
|
|
echo "nnn is already running"
|
|
|
|
return
|
|
|
|
fi
|
2021-02-13 11:28:59 -05:00
|
|
|
|
2021-03-08 16:18:17 -05:00
|
|
|
# The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
|
|
|
|
# To cd on quit only on ^G, remove the "export" as in:
|
|
|
|
# NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
|
|
|
# NOTE: NNN_TMPFILE is fixed, should not be modified
|
|
|
|
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
2021-02-13 11:28:59 -05:00
|
|
|
|
2021-03-08 16:18:17 -05:00
|
|
|
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
|
|
|
# stty start undef
|
|
|
|
# stty stop undef
|
|
|
|
# stty lwrap undef
|
|
|
|
# stty lnext undef
|
2021-02-13 11:28:59 -05:00
|
|
|
|
2021-03-08 16:18:17 -05:00
|
|
|
nnn "$@"
|
2021-02-13 11:28:59 -05:00
|
|
|
|
2021-03-08 16:18:17 -05:00
|
|
|
if [ -f "$NNN_TMPFILE" ]; then
|
|
|
|
. "$NNN_TMPFILE"
|
|
|
|
rm -f "$NNN_TMPFILE" > /dev/null
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# nnn in dual pane mode (tmux)
|
|
|
|
n2() {
|
|
|
|
tmux new-session -d -s nnn -n nnn "nnn -Hc"
|
|
|
|
tmux split-window -h "nnn -Hc"
|
|
|
|
TERM=screen-256color tmux attach -t nnn:nnn
|
|
|
|
}
|
|
|
|
fi
|
2021-02-13 11:28:59 -05:00
|
|
|
|
|
|
|
# typing speed testing
|
|
|
|
tt() {
|
|
|
|
iconv -f UTF-8 -t ASCII "$1" | sed 's/--/-/g' \
|
|
|
|
| sed '/^$/d' | sed 's/^[ \t]*//' | sed 's/\(^.\{1,80\}\).*/\1/' \
|
|
|
|
> /tmp/tt.txt
|
|
|
|
command tt /tmp/tt.txt
|
|
|
|
}
|
|
|
|
|
|
|
|
# ________ _______________
|
|
|
|
# __ ___/______ /__ /___(_)_____________ ________
|
|
|
|
# _____ \_ _ \ __/ __/_ /__ __ \_ __ `/_ ___/
|
|
|
|
# ____/ // __/ /_ / /_ _ / _ / / / /_/ /_(__ )
|
|
|
|
# /____/ \___/\__/ \__/ /_/ /_/ /_/_\__, / /____/
|
|
|
|
# /____/
|
|
|
|
#
|
|
|
|
mkdir -p "$BASH_COMPLETION_USER_DIR/completions"
|
|
|
|
|
|
|
|
# github cli completion
|
2021-03-17 09:04:27 -04:00
|
|
|
# if command -v gh >/dev/null && [ ! -f "$BASH_COMPLETION_USER_DIR/completions/gh" ]; then
|
|
|
|
# gh completion -s bash > "$BASH_COMPLETION_USER_DIR/completions/gh"
|
|
|
|
# fi
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# kitten from kitty
|
|
|
|
if command -v kitty > /dev/null; then
|
|
|
|
source <(kitty + complete setup bash)
|
|
|
|
fi
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# Starship prompt
|
|
|
|
if command -v starship > /dev/null; then
|
|
|
|
eval "$(starship init bash --print-full-init)"
|
|
|
|
fi
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# direnv
|
|
|
|
if command -v direnv >/dev/null ; then
|
|
|
|
eval "$(direnv hook bash)"
|
|
|
|
fi
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# poetry
|
|
|
|
# if [ ! -d "$POETRY_HOME" ]; then
|
|
|
|
# curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
|
|
|
|
# fi
|
|
|
|
# if [[ ! -f $BASH_COMPLETION_USER_DIR/completions/poetry ]]; then
|
|
|
|
# poetry completions bash > "$BASH_COMPLETION_USER_DIR/completions/poetry"
|
|
|
|
# fi
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# pyenv
|
|
|
|
# if [[ ! -d $PYENV_ROOT ]]; then
|
|
|
|
# git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT
|
|
|
|
# git clone https://github.com/pyenv/pyenv-virtualenv.git $PYENV_ROOT/plugins/pyenv-virtualenv
|
|
|
|
# git clone https://github.com/pyenv/pyenv-update.git $PYENV_ROOT/plugins/pyenv-update
|
|
|
|
# fi
|
2021-06-16 08:05:11 -04:00
|
|
|
# if shopt -q login_shell; then
|
|
|
|
# eval "$(pyenv init --path)"
|
|
|
|
# fi
|
|
|
|
# eval "$(pyenv init -)"
|
2021-02-13 11:28:59 -05:00
|
|
|
# eval "$(pyenv virtualenv-init -)"
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# nodenv
|
|
|
|
# if [[ ! -d $NODENV_ROOT ]]; then
|
|
|
|
# git clone https://github.com/nodenv/nodenv.git $NODENV_ROOT
|
|
|
|
# mkdir -p $NODENV_ROOT/plugins
|
|
|
|
# git clone https://github.com/nodenv/node-build.git $NODENV_ROOT/plugins/node-build
|
|
|
|
# git clone https://github.com/nodenv/nodenv-env.git $NODENV_ROOT/plugins/nodenv-env
|
|
|
|
# git clone https://github.com/nodenv/nodenv-man.git $NODENV_ROOT/plugins/nodenv-man
|
|
|
|
# git clone https://github.com/nodenv/nodenv-aliases.git $NODENV_ROOT/plugins/nodenv-aliases
|
|
|
|
# git clone https://github.com/nodenv/nodenv-each.git $NODENV_ROOT/plugins/nodenv-each
|
|
|
|
# git clone https://github.com/nodenv/nodenv-update.git $NODENV_ROOT/plugins/nodenv-update
|
|
|
|
# git clone https://github.com/nodenv/nodenv-vars.git $NODENV_ROOT/plugins/nodenv-vars
|
|
|
|
# fi
|
|
|
|
# eval "$(nodenv init -)"
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# z.lua
|
2021-03-08 16:18:17 -05:00
|
|
|
# if [[ ! -f "$HOME/.local/share/bash/z.lua" ]]; then
|
|
|
|
# curl -fLo $HOME/.local/share/bash/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua
|
|
|
|
# mkdir -p $HOME/.local/share/zlua
|
|
|
|
# fi
|
|
|
|
# eval "$(lua $HOME/.local/share/bash/z.lua --init bash fzf)"
|
|
|
|
# if command -v ranger >/dev/null; then
|
|
|
|
# if [ ! -f "$HOME/.config/ranger/plugins/ranger_zlua.py" ]; then
|
|
|
|
# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
# alias zz='z -c' # restrict matches to subdirs of $PWD
|
|
|
|
# alias zi='z -i' # cd with interactive selection
|
|
|
|
# alias zf='z -I' # use fzf to select in multiple matches
|
|
|
|
# alias zb='z -b' # quickly cd to the parent directory
|
|
|
|
|
|
|
|
# zoxide
|
|
|
|
if command -v zoxide >/dev/null; then
|
|
|
|
eval "$(zoxide init bash)"
|
2021-02-13 11:28:59 -05:00
|
|
|
fi
|
2021-03-08 16:18:17 -05:00
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# autostart gpg-agent at login
|
|
|
|
if ! pgrep -u "$USER" gpg-agent >/dev/null; then
|
|
|
|
gpg-agent --daemon --enable-ssh-support >/dev/null
|
|
|
|
fi
|
|
|
|
if [[ -z "$SSH_AUTH_SOCK" ]]; then
|
|
|
|
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
|
|
|
fi
|
|
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
|
|
|
|
|
|
# vi mode
|
|
|
|
set -o vi
|
|
|
|
bind 'set show-mode-in-prompt on'
|
|
|
|
bind 'set vi-cmd-mode-string "\e[01;32mN "'
|
|
|
|
bind 'set vi-ins-mode-string "\e[01;32mI "'
|
|
|
|
|
|
|
|
# ignore upper and lowercase when TAB completion
|
|
|
|
bind "set completion-ignore-case on"
|
|
|
|
|
2021-06-13 00:37:06 -04:00
|
|
|
# Better default modes
|
|
|
|
umask 0027
|
|
|
|
|
2021-02-13 11:28:59 -05:00
|
|
|
# Shell options
|
|
|
|
shopt -s autocd
|
|
|
|
shopt -s cdspell
|
|
|
|
shopt -s cmdhist
|
|
|
|
shopt -s dotglob
|
|
|
|
shopt -s checkwinsize
|
|
|
|
shopt -s expand_aliases
|
|
|
|
shopt -s histappend
|
|
|
|
|
2021-05-02 19:12:01 -04:00
|
|
|
export PS2="\[\e[1;31m\]> "
|
|
|
|
|
|
|
|
# ______________ _____
|
|
|
|
# ___ __ \__ /___ ________ ___(_)______________
|
|
|
|
# __ /_/ /_ /_ / / /_ __ `/_ /__ __ \_ ___/
|
|
|
|
# _ ____/_ / / /_/ /_ /_/ /_ / _ / / /(__ )
|
|
|
|
# /_/ /_/ \__,_/ _\__, / /_/ /_/ /_//____/
|
|
|
|
# /____/
|
|
|
|
# forgit
|
|
|
|
if [ ! -f "$BASH_COMPLETION_USER_DIR/plugins/forgit.plugin.bash" ]; then
|
|
|
|
curl -fLo $BASH_COMPLETION_USER_DIR/plugins/forgit.plugin.bash https://github.com/wfxr/forgit/raw/master/forgit.plugin.zsh
|
|
|
|
fi
|
|
|
|
source $BASH_COMPLETION_USER_DIR/plugins/forgit.plugin.sh
|
|
|
|
|
2021-05-03 08:50:23 -04:00
|
|
|
if [ -n "$XDG_SESSION_TYPE" ]; then
|
|
|
|
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
|
|
|
export FORGIT_COPY_CMD="wl-copy"
|
2021-05-02 21:09:07 -04:00
|
|
|
else
|
2021-05-03 08:50:23 -04:00
|
|
|
if command -v xclip >/dev/null; then
|
|
|
|
export FORGIT_COPY_CMD="xclip -selection clipboard"
|
|
|
|
else
|
|
|
|
export FORGIT_COPY_CMD="xsel -i -b"
|
|
|
|
fi
|
2021-05-02 21:09:07 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-05-02 19:12:01 -04:00
|
|
|
# If I don't want starship
|
|
|
|
# source $BASH_COMPLETION_USER_DIR/plugins/prompt.bash
|
|
|
|
|
|
|
|
# fzf
|
|
|
|
if [ ! -f "$BASH_COMPLETION_USER_DIR/plugins/fzf-completion.bash" ] || [ ! -f "$BASH_COMPLETION_USER_DIR/plugins/fzf-bindings.bash" ]; then
|
|
|
|
curl -fLo $BASH_COMPLETION_USER_DIR/plugins/fzf-completion.bash https://github.com/junegunn/fzf/raw/master/shell/completion.bash
|
|
|
|
curl -fLo $BASH_COMPLETION_USER_DIR/plugins/fzf-bindings.bash https://github.com/junegunn/fzf/raw/master/shell/key-bindings.bash
|
|
|
|
fi
|
|
|
|
source $BASH_COMPLETION_USER_DIR/plugins/fzf-completion.bash
|
|
|
|
source $BASH_COMPLETION_USER_DIR/plugins/fzf-bindings.bash
|
2021-02-13 11:28:59 -05:00
|
|
|
export FZF_COMPLETION_OPTS='-x'
|
|
|
|
|
|
|
|
# Use fd instead of find for fzf_completion
|
|
|
|
_fzf_compgen_path() {
|
|
|
|
fd --hidden --follow --exclude ".git" . "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
_fzf_compgen_dir() {
|
|
|
|
fd --type d --hidden --follow --exclude ".git" . "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Some more completions with fzf
|
|
|
|
_fzf_setup_completion path ag kubectl
|
|
|
|
_fzf_setup_completion dir tree
|
|
|
|
|
|
|
|
# ^X^R
|
|
|
|
bind "$(bind -s | grep '^"\\C-r"' | sed 's/"/"\\C-x/' | sed 's/"$/\\C-m"/')"
|
|
|
|
|
|
|
|
$HOME/.local/bin/bunny
|