Add .xprofile
This commit is contained in:
parent
e67bfb8bc2
commit
136e68c2ff
3 changed files with 659 additions and 0 deletions
279
.bashrc
Normal file
279
.bashrc
Normal file
|
@ -0,0 +1,279 @@
|
||||||
|
# ____ _____
|
||||||
|
# | _ \_ _| Derek Taylor (DistroTube)
|
||||||
|
# | | | || | http://www.youtube.com/c/DistroTube
|
||||||
|
# | |_| || | http://www.gitlab.com/dwt1/
|
||||||
|
# |____/ |_|
|
||||||
|
#
|
||||||
|
# My bash config. Not much to see here; just some pretty standard stuff.
|
||||||
|
|
||||||
|
### EXPORT
|
||||||
|
export TERM="xterm-256color" # getting proper colors
|
||||||
|
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
|
||||||
|
export ALTERNATE_EDITOR="" # setting for emacsclient
|
||||||
|
export EDITOR="emacsclient -t -a ''" # $EDITOR use Emacs in terminal
|
||||||
|
export VISUAL="emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode
|
||||||
|
|
||||||
|
### SET MANPAGER
|
||||||
|
### Uncomment only one of these!
|
||||||
|
|
||||||
|
### "bat" as manpager
|
||||||
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
|
||||||
|
### "vim" as manpager
|
||||||
|
# export MANPAGER='/bin/bash -c "vim -MRn -c \"set buftype=nofile showtabline=0 ft=man ts=8 nomod nolist norelativenumber nonu noma\" -c \"normal L\" -c \"nmap q :qa<CR>\"</dev/tty <(col -b)"'
|
||||||
|
|
||||||
|
### "nvim" as manpager
|
||||||
|
# export MANPAGER="nvim -c 'set ft=man' -"
|
||||||
|
|
||||||
|
### SET VI MODE ###
|
||||||
|
# Comment this line out to enable default emacs-like bindings
|
||||||
|
set -o vi
|
||||||
|
bind -m vi-command 'Control-l: clear-screen'
|
||||||
|
bind -m vi-insert 'Control-l: clear-screen'
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything
|
||||||
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
|
### PROMPT
|
||||||
|
# This is commented out if using starship prompt
|
||||||
|
# PS1='[\u@\h \W]\$ '
|
||||||
|
|
||||||
|
### PATH
|
||||||
|
if [ -d "$HOME/.bin" ] ;
|
||||||
|
then PATH="$HOME/.bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/.local/bin" ] ;
|
||||||
|
then PATH="$HOME/.local/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/Applications" ] ;
|
||||||
|
then PATH="$HOME/Applications:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
### CHANGE TITLE OF TERMINALS
|
||||||
|
case ${TERM} in
|
||||||
|
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*)
|
||||||
|
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
|
||||||
|
;;
|
||||||
|
screen*)
|
||||||
|
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
### SHOPT
|
||||||
|
shopt -s autocd # change to named directory
|
||||||
|
shopt -s cdspell # autocorrects cd misspellings
|
||||||
|
shopt -s cmdhist # save multi-line commands in history as single line
|
||||||
|
shopt -s dotglob
|
||||||
|
shopt -s histappend # do not overwrite history
|
||||||
|
shopt -s expand_aliases # expand aliases
|
||||||
|
shopt -s checkwinsize # checks term size when bash regains control
|
||||||
|
|
||||||
|
#ignore upper and lowercase when TAB completion
|
||||||
|
bind "set completion-ignore-case on"
|
||||||
|
|
||||||
|
### ARCHIVE EXTRACTION
|
||||||
|
# usage: ex <file>
|
||||||
|
ex ()
|
||||||
|
{
|
||||||
|
if [ -f $1 ] ; then
|
||||||
|
case $1 in
|
||||||
|
*.tar.bz2) tar xjf $1 ;;
|
||||||
|
*.tar.gz) tar xzf $1 ;;
|
||||||
|
*.bz2) bunzip2 $1 ;;
|
||||||
|
*.rar) unrar x $1 ;;
|
||||||
|
*.gz) gunzip $1 ;;
|
||||||
|
*.tar) tar xf $1 ;;
|
||||||
|
*.tbz2) tar xjf $1 ;;
|
||||||
|
*.tgz) tar xzf $1 ;;
|
||||||
|
*.zip) unzip $1 ;;
|
||||||
|
*.Z) uncompress $1;;
|
||||||
|
*.7z) 7z x $1 ;;
|
||||||
|
*.deb) ar x $1 ;;
|
||||||
|
*.tar.xz) tar xf $1 ;;
|
||||||
|
*.tar.zst) unzstd $1 ;;
|
||||||
|
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "'$1' is not a valid file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
### ALIASES ###
|
||||||
|
|
||||||
|
# root privileges
|
||||||
|
alias doas="doas --"
|
||||||
|
|
||||||
|
# navigation
|
||||||
|
up () {
|
||||||
|
local d=""
|
||||||
|
local limit="$1"
|
||||||
|
|
||||||
|
# Default to limit of 1
|
||||||
|
if [ -z "$limit" ] || [ "$limit" -le 0 ]; then
|
||||||
|
limit=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ((i=1;i<=limit;i++)); do
|
||||||
|
d="../$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# perform cd. Show error if cd fails
|
||||||
|
if ! cd "$d"; then
|
||||||
|
echo "Couldn't go up $limit dirs.";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim and emacs
|
||||||
|
alias vim="nvim"
|
||||||
|
alias em="/usr/bin/emacs -nw"
|
||||||
|
alias emacs="emacsclient -c -a 'emacs'"
|
||||||
|
alias doomsync="~/.emacs.d/bin/doom sync"
|
||||||
|
alias doomdoctor="~/.emacs.d/bin/doom doctor"
|
||||||
|
alias doomupgrade="~/.emacs.d/bin/doom upgrade"
|
||||||
|
alias doompurge="~/.emacs.d/bin/doom purge"
|
||||||
|
|
||||||
|
# Changing "ls" to "exa"
|
||||||
|
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
|
||||||
|
alias la='exa -a --color=always --group-directories-first' # all files and dirs
|
||||||
|
alias ll='exa -l --color=always --group-directories-first' # long format
|
||||||
|
alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
||||||
|
alias l.='exa -a | egrep "^\."'
|
||||||
|
|
||||||
|
# pacman and yay
|
||||||
|
alias pacsyu='sudo pacman -Syyu' # update only standard pkgs
|
||||||
|
alias yaysua='yay -Sua --noconfirm' # update only AUR pkgs (yay)
|
||||||
|
alias yaysyu='yay -Syu --noconfirm' # update standard pkgs and AUR pkgs (yay)
|
||||||
|
alias parsua='paru -Sua --noconfirm' # update only AUR pkgs (paru)
|
||||||
|
alias parsyu='paru -Syu --noconfirm' # update standard pkgs and AUR pkgs (paru)
|
||||||
|
alias unlock='sudo rm /var/lib/pacman/db.lck' # remove pacman lock
|
||||||
|
alias cleanup='sudo pacman -Rns (pacman -Qtdq)' # remove orphaned packages
|
||||||
|
|
||||||
|
# get fastest mirrors
|
||||||
|
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
|
||||||
|
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
|
||||||
|
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
|
||||||
|
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
|
||||||
|
|
||||||
|
# Colorize grep output (good for log files)
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
|
||||||
|
# confirm before overwriting something
|
||||||
|
alias cp="cp -i"
|
||||||
|
alias mv='mv -i'
|
||||||
|
alias rm='rm -i'
|
||||||
|
|
||||||
|
# adding flags
|
||||||
|
alias df='df -h' # human-readable sizes
|
||||||
|
alias free='free -m' # show sizes in MB
|
||||||
|
alias lynx='lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss -vikeys'
|
||||||
|
alias vifm='./.config/vifm/scripts/vifmrun'
|
||||||
|
alias ncmpcpp='ncmpcpp ncmpcpp_directory=$HOME/.config/ncmpcpp/'
|
||||||
|
alias mocp='mocp -M "$XDG_CONFIG_HOME"/moc -O MOCDir="$XDG_CONFIG_HOME"/moc'
|
||||||
|
|
||||||
|
# ps
|
||||||
|
alias psa="ps auxf"
|
||||||
|
alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e"
|
||||||
|
alias psmem='ps auxf | sort -nr -k 4'
|
||||||
|
alias pscpu='ps auxf | sort -nr -k 3'
|
||||||
|
|
||||||
|
# Merge Xresources
|
||||||
|
alias merge='xrdb -merge ~/.Xresources'
|
||||||
|
|
||||||
|
# git
|
||||||
|
alias addup='git add -u'
|
||||||
|
alias addall='git add .'
|
||||||
|
alias branch='git branch'
|
||||||
|
alias checkout='git checkout'
|
||||||
|
alias clone='git clone'
|
||||||
|
alias commit='git commit -m'
|
||||||
|
alias fetch='git fetch'
|
||||||
|
alias pull='git pull origin'
|
||||||
|
alias push='git push origin'
|
||||||
|
alias stat='git status' # 'status' is protected name so using 'stat' instead
|
||||||
|
alias tag='git tag'
|
||||||
|
alias newtag='git tag -a'
|
||||||
|
|
||||||
|
# get error messages from journalctl
|
||||||
|
alias jctl="journalctl -p 3 -xb"
|
||||||
|
|
||||||
|
# gpg encryption
|
||||||
|
# verify signature for isos
|
||||||
|
alias gpg-check="gpg2 --keyserver-options auto-key-retrieve --verify"
|
||||||
|
# receive the key of a developer
|
||||||
|
alias gpg-retrieve="gpg2 --keyserver-options auto-key-retrieve --receive-keys"
|
||||||
|
|
||||||
|
# youtube-dl
|
||||||
|
alias yta-aac="youtube-dl --extract-audio --audio-format aac "
|
||||||
|
alias yta-best="youtube-dl --extract-audio --audio-format best "
|
||||||
|
alias yta-flac="youtube-dl --extract-audio --audio-format flac "
|
||||||
|
alias yta-m4a="youtube-dl --extract-audio --audio-format m4a "
|
||||||
|
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 "
|
||||||
|
alias yta-opus="youtube-dl --extract-audio --audio-format opus "
|
||||||
|
alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis "
|
||||||
|
alias yta-wav="youtube-dl --extract-audio --audio-format wav "
|
||||||
|
alias ytv-best="youtube-dl -f bestvideo+bestaudio "
|
||||||
|
|
||||||
|
# switch between shells
|
||||||
|
# I do not recommend switching default SHELL from bash.
|
||||||
|
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
||||||
|
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
||||||
|
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
||||||
|
|
||||||
|
# bare git repo alias for dotfiles
|
||||||
|
alias config="/usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME"
|
||||||
|
|
||||||
|
# termbin
|
||||||
|
alias tb="nc termbin.com 9999"
|
||||||
|
|
||||||
|
# the terminal rickroll
|
||||||
|
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash'
|
||||||
|
|
||||||
|
# Unlock LBRY tips
|
||||||
|
alias tips='lbrynet txo spend --type=support --is_not_my_input --blocking'
|
||||||
|
|
||||||
|
### DTOS ###
|
||||||
|
# Copy/paste all content of /etc/dtos over to home folder. A backup of config is created. (Be careful running this!)
|
||||||
|
alias dtoscopy='[ -d ~/.config ] || mkdir ~/.config && cp -Rf ~/.config ~/.config-backup-$(date +%Y.%m.%d-%H.%M.%S) && cp -rf /etc/dtos/* ~'
|
||||||
|
# Backup contents of /etc/dtos to a backup folder in $HOME.
|
||||||
|
alias dtosbackup='cp -Rf /etc/dtos ~/dtos-backup-$(date +%Y.%m.%d-%H.%M.%S)'
|
||||||
|
|
||||||
|
### RANDOM COLOR SCRIPT ###
|
||||||
|
# Get this script from my GitLab: gitlab.com/dwt1/shell-color-scripts
|
||||||
|
# Or install it from the Arch User Repository: shell-color-scripts
|
||||||
|
colorscript random
|
||||||
|
|
||||||
|
### BASH INSULTER ###
|
||||||
|
if [ -f /etc/bash.command-not-found ]; then
|
||||||
|
. /etc/bash.command-not-found
|
||||||
|
fi
|
||||||
|
|
||||||
|
### SETTING THE STARSHIP PROMPT ###
|
||||||
|
eval "$(starship init bash)"
|
||||||
|
|
||||||
|
##-> DreymaR's SetXKB.sh: Activate layout
|
||||||
|
setxkbmap -model 'pc104angle-z' -layout 'us(cmk_ed_us)' -option 'misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:rctrl,misc:cmk_curl_dh'
|
||||||
|
##<- DreymaR's SetXKB.sh
|
||||||
|
|
||||||
|
##-> DreymaR's SetXKB.sh: Activate layout
|
||||||
|
setxkbmap -model 'pc104angle-z' -layout 'us(cmk_ed_us)' -option 'misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:rctrl,misc:cmk_curl_dh'
|
||||||
|
##<- DreymaR's SetXKB.sh
|
||||||
|
|
||||||
|
# >>> conda initialize >>>
|
||||||
|
# !! Contents within this block are managed by 'conda init' !!
|
||||||
|
__conda_setup="$('/home/phil/tech/Apps/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
eval "$__conda_setup"
|
||||||
|
else
|
||||||
|
if [ -f "/home/phil/tech/Apps/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||||
|
. "/home/phil/tech/Apps/miniconda3/etc/profile.d/conda.sh"
|
||||||
|
else
|
||||||
|
export PATH="/home/phil/tech/Apps/miniconda3/bin:$PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset __conda_setup
|
||||||
|
# <<< conda initialize <<<
|
||||||
|
|
3
.xprofile
Normal file
3
.xprofile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
if [ "$XDG_CURRENT_DESKTOP" = "i3" ]; then
|
||||||
|
export QT_QPA_PLATFORMTHEME="qt5ct"
|
||||||
|
fi
|
377
.zshrc
Normal file
377
.zshrc
Normal file
|
@ -0,0 +1,377 @@
|
||||||
|
# ____ _____
|
||||||
|
# | _ \_ _| Derek Taylor (DistroTube)
|
||||||
|
# | | | || | http://www.youtube.com/c/DistroTube
|
||||||
|
# | |_| || | http://www.gitlab.com/dwt1/
|
||||||
|
# |____/ |_|
|
||||||
|
# My zsh config. Not much to see here; just some pretty standard stuff.
|
||||||
|
|
||||||
|
export ZSH=$HOME/.oh-my-zsh
|
||||||
|
ZSH_THEME=zhann
|
||||||
|
|
||||||
|
DISABLE_AUTO_UPDATE="true"
|
||||||
|
|
||||||
|
### EXPORT
|
||||||
|
export TERM="xterm-256color" # getting proper colors
|
||||||
|
# export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
|
||||||
|
|
||||||
|
export EDITOR="emacsclient -t -a ''" # $EDITOR use Emacs in terminal
|
||||||
|
export VISUAL="emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode
|
||||||
|
|
||||||
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
setopt auto_cd
|
||||||
|
|
||||||
|
### Source Fish-style syntax highlighting and autosuggestions
|
||||||
|
|
||||||
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
|
||||||
|
### AUTOLOAD & Zstyle
|
||||||
|
|
||||||
|
autoload -Uz compinit promptinit
|
||||||
|
compinit
|
||||||
|
promptinit
|
||||||
|
|
||||||
|
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
||||||
|
zle -N up-line-or-beginning-search
|
||||||
|
zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
DIRSTACKFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/dirs"
|
||||||
|
if [[ -f "$DIRSTACKFILE" ]] && (( ${#dirstack} == 0 )); then
|
||||||
|
dirstack=("${(@f)"$(< "$DIRSTACKFILE")"}")
|
||||||
|
[[ -d "${dirstack[1]}" ]] && cd -- "${dirstack[1]}"
|
||||||
|
fi
|
||||||
|
chpwd_dirstack() {
|
||||||
|
print -l -- "$PWD" "${(u)dirstack[@]}" > "$DIRSTACKFILE"
|
||||||
|
}
|
||||||
|
add-zsh-hook -Uz chpwd chpwd_dirstack
|
||||||
|
|
||||||
|
DIRSTACKSIZE='20'
|
||||||
|
|
||||||
|
zshcache_time="$(date +%s%N)"
|
||||||
|
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
rehash_precmd() {
|
||||||
|
if [[ -a /var/cache/zsh/pacman ]]; then
|
||||||
|
local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
|
||||||
|
if (( zshcache_time < paccache_time )); then
|
||||||
|
rehash
|
||||||
|
zshcache_time="$paccache_time"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
add-zsh-hook -Uz precmd rehash_precmd
|
||||||
|
|
||||||
|
## Exit shell even when command line is partially fullcircle
|
||||||
|
|
||||||
|
exit_zsh() { exit }
|
||||||
|
zle -N exit_zsh
|
||||||
|
bindkey '^D' exit_zsh
|
||||||
|
|
||||||
|
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME
|
||||||
|
|
||||||
|
## Remove duplicate entries
|
||||||
|
setopt PUSHD_IGNORE_DUPS
|
||||||
|
|
||||||
|
## This reverts the +/- operators.
|
||||||
|
setopt PUSHD_MINUS
|
||||||
|
|
||||||
|
### Keyboard bindings
|
||||||
|
|
||||||
|
# create a zkbd compatible hash;
|
||||||
|
# to add other keys to this hash, see: man 5 terminfo
|
||||||
|
typeset -g -A key
|
||||||
|
|
||||||
|
key[Home]="${terminfo[khome]}"
|
||||||
|
key[End]="${terminfo[kend]}"
|
||||||
|
key[Insert]="${terminfo[kich1]}"
|
||||||
|
key[Backspace]="${terminfo[kbs]}"
|
||||||
|
key[Delete]="${terminfo[kdch1]}"
|
||||||
|
key[Up]="${terminfo[kcuu1]}"
|
||||||
|
key[Down]="${terminfo[kcud1]}"
|
||||||
|
key[Left]="${terminfo[kcub1]}"
|
||||||
|
key[Right]="${terminfo[kcuf1]}"
|
||||||
|
key[PageUp]="${terminfo[kpp]}"
|
||||||
|
key[PageDown]="${terminfo[knp]}"
|
||||||
|
key[Shift-Tab]="${terminfo[kcbt]}"
|
||||||
|
|
||||||
|
# setup key accordingly
|
||||||
|
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
|
||||||
|
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
|
||||||
|
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
|
||||||
|
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
|
||||||
|
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
|
||||||
|
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
|
||||||
|
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
|
||||||
|
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
|
||||||
|
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
|
||||||
|
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
|
||||||
|
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
||||||
|
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
|
||||||
|
|
||||||
|
# Finally, make sure the terminal is in application mode, when zle is
|
||||||
|
# active. Only then are the values from $terminfo valid.
|
||||||
|
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
||||||
|
autoload -Uz add-zle-hook-widget
|
||||||
|
function zle_application_mode_start { echoti smkx }
|
||||||
|
function zle_application_mode_stop { echoti rmkx }
|
||||||
|
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
|
||||||
|
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
### PLUGINS
|
||||||
|
|
||||||
|
plugins=(
|
||||||
|
archlinux
|
||||||
|
emacs
|
||||||
|
npm
|
||||||
|
zsh-autocomplete
|
||||||
|
zsh-autosuggestions
|
||||||
|
zsh-completions
|
||||||
|
zsh-syntax-highlighting
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything
|
||||||
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
|
### PATH
|
||||||
|
if [ -d "$HOME/.bin" ] ;
|
||||||
|
then PATH="$HOME/.bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/.local/bin" ] ;
|
||||||
|
then PATH="$HOME/.local/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/Applications" ] ;
|
||||||
|
then PATH="$HOME/Applications:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CHANGE TITLE OF TERMINALS
|
||||||
|
|
||||||
|
case ${TERM} in
|
||||||
|
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*)
|
||||||
|
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
|
||||||
|
;;
|
||||||
|
screen*)
|
||||||
|
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
### Function extract for common file formats ###
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
|
||||||
|
function extract {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
# display usage if no parameters given
|
||||||
|
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
||||||
|
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
|
||||||
|
else
|
||||||
|
for n in "$@"
|
||||||
|
do
|
||||||
|
if [ -f "$n" ] ; then
|
||||||
|
case "${n%,}" in
|
||||||
|
*.cbt|*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
|
||||||
|
tar xvf "$n" ;;
|
||||||
|
*.lzma) unlzma ./"$n" ;;
|
||||||
|
*.bz2) bunzip2 ./"$n" ;;
|
||||||
|
*.cbr|*.rar) unrar x -ad ./"$n" ;;
|
||||||
|
*.gz) gunzip ./"$n" ;;
|
||||||
|
*.cbz|*.epub|*.zip) unzip ./"$n" ;;
|
||||||
|
*.z) uncompress ./"$n" ;;
|
||||||
|
*.7z|*.arj|*.cab|*.cb7|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.pkg|*.rpm|*.udf|*.wim|*.xar)
|
||||||
|
7z x ./"$n" ;;
|
||||||
|
*.xz) unxz ./"$n" ;;
|
||||||
|
*.exe) cabextract ./"$n" ;;
|
||||||
|
*.cpio) cpio -id < ./"$n" ;;
|
||||||
|
*.cba|*.ace) unace x ./"$n" ;;
|
||||||
|
*)
|
||||||
|
echo "extract: '$n' - unknown archive method"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "'$n' - file does not exist"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
IFS=$SAVEIFS
|
||||||
|
|
||||||
|
### ALIASES ###
|
||||||
|
|
||||||
|
# root privileges
|
||||||
|
alias doas="doas --"
|
||||||
|
|
||||||
|
# navigation
|
||||||
|
up () {
|
||||||
|
local d=""
|
||||||
|
local limit="$1"
|
||||||
|
|
||||||
|
# Default to limit of 1
|
||||||
|
if [ -z "$limit" ] || [ "$limit" -le 0 ]; then
|
||||||
|
limit=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ((i=1;i<=limit;i++)); do
|
||||||
|
d="../$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# perform cd. Show error if cd fails
|
||||||
|
if ! cd "$d"; then
|
||||||
|
echo "Couldn't go up $limit dirs.";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#kill and pkill
|
||||||
|
|
||||||
|
alias kk="pkill"
|
||||||
|
alias ka="killall"
|
||||||
|
|
||||||
|
# vim and emacs
|
||||||
|
alias vim="nvim"
|
||||||
|
alias em="/usr/bin/emacs -nw"
|
||||||
|
alias emacs="emacsclient -c -a 'emacs'"
|
||||||
|
alias doomsync="~/.emacs.d/bin/doom sync"
|
||||||
|
alias doomdoctor="~/.emacs.d/bin/doom doctor"
|
||||||
|
alias doomupgrade="~/.emacs.d/bin/doom upgrade"
|
||||||
|
alias doompurge="~/.emacs.d/bin/doom purge"
|
||||||
|
|
||||||
|
# Changing "ls" to "exa"
|
||||||
|
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
|
||||||
|
alias la='exa -a --color=always --group-directories-first' # all files and dirs
|
||||||
|
alias ll='exa -l --color=always --group-directories-first' # long format
|
||||||
|
alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
||||||
|
alias l.='exa -a | egrep "^\."'
|
||||||
|
|
||||||
|
# pacman and yay
|
||||||
|
alias pacsyu='sudo pacman -Syyu' # update only standard pkgs
|
||||||
|
alias yaysua='yay -Sua --noconfirm' # update only AUR pkgs (yay)
|
||||||
|
alias yaysyu='yay -Syu --noconfirm' # update standard pkgs and AUR pkgs (yay)
|
||||||
|
alias parsua='paru -Sua --noconfirm' # update only AUR pkgs (paru)
|
||||||
|
alias parsyu='paru -Syu --noconfirm' # update standard pkgs and AUR pkgs (paru)
|
||||||
|
alias unlock='sudo rm /var/lib/pacman/db.lck' # remove pacman lock
|
||||||
|
alias cleanup='sudo pacman -Rns (pacman -Qtdq)' # remove orphaned packages
|
||||||
|
|
||||||
|
# get fastest mirrors
|
||||||
|
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
|
||||||
|
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
|
||||||
|
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
|
||||||
|
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
|
||||||
|
|
||||||
|
# Colorize grep output (good for log files)
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
|
||||||
|
# confirm before overwriting something
|
||||||
|
alias cp="cp -i"
|
||||||
|
alias mv='mv -i'
|
||||||
|
alias rm='rm -i'
|
||||||
|
|
||||||
|
# adding flags
|
||||||
|
alias df='df -h' # human-readable sizes
|
||||||
|
alias free='free -m' # show sizes in MB
|
||||||
|
alias lynx='lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss -vikeys'
|
||||||
|
alias vifm='./.config/vifm/scripts/vifmrun'
|
||||||
|
alias ncmpcpp='ncmpcpp ncmpcpp_directory=$HOME/.config/ncmpcpp/'
|
||||||
|
alias mocp='mocp -M "$XDG_CONFIG_HOME"/moc -O MOCDir="$XDG_CONFIG_HOME"/moc'
|
||||||
|
|
||||||
|
# ps
|
||||||
|
alias psa="ps auxf"
|
||||||
|
alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e"
|
||||||
|
alias psmem='ps auxf | sort -nr -k 4'
|
||||||
|
alias pscpu='ps auxf | sort -nr -k 3'
|
||||||
|
|
||||||
|
# Merge Xresources
|
||||||
|
alias merge='xrdb -merge ~/.Xresources'
|
||||||
|
|
||||||
|
# git
|
||||||
|
alias addup='git add -u'
|
||||||
|
alias addall='git add .'
|
||||||
|
alias branch='git branch'
|
||||||
|
alias checkout='git checkout'
|
||||||
|
alias clone='git clone'
|
||||||
|
alias commit='git commit -m'
|
||||||
|
alias fetch='git fetch'
|
||||||
|
alias pull='git pull origin'
|
||||||
|
alias push='git push origin'
|
||||||
|
alias stat='git status' # 'status' is protected name so using 'stat' instead
|
||||||
|
alias tag='git tag'
|
||||||
|
alias newtag='git tag -a'
|
||||||
|
|
||||||
|
# get error messages from journalctl
|
||||||
|
alias jctl="journalctl -p 3 -xb"
|
||||||
|
|
||||||
|
# gpg encryption
|
||||||
|
# verify signature for isos
|
||||||
|
alias gpg-check="gpg2 --keyserver-options auto-key-retrieve --verify"
|
||||||
|
# receive the key of a developer
|
||||||
|
alias gpg-retrieve="gpg2 --keyserver-options auto-key-retrieve --receive-keys"
|
||||||
|
|
||||||
|
# youtube-dl
|
||||||
|
alias yta-aac="youtube-dl --extract-audio --audio-format aac "
|
||||||
|
alias yta-best="youtube-dl --extract-audio --audio-format best "
|
||||||
|
alias yta-flac="youtube-dl --extract-audio --audio-format flac "
|
||||||
|
alias yta-m4a="youtube-dl --extract-audio --audio-format m4a "
|
||||||
|
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 "
|
||||||
|
alias yta-opus="youtube-dl --extract-audio --audio-format opus "
|
||||||
|
alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis "
|
||||||
|
alias yta-wav="youtube-dl --extract-audio --audio-format wav "
|
||||||
|
alias ytv-best="youtube-dl -f bestvideo+bestaudio "
|
||||||
|
|
||||||
|
# switch between shells
|
||||||
|
# I do not recommend switching default SHELL from bash.
|
||||||
|
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
||||||
|
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
||||||
|
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
||||||
|
|
||||||
|
# bare git repo alias for dotfiles
|
||||||
|
alias config="/usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME"
|
||||||
|
|
||||||
|
# termbin
|
||||||
|
alias tb="nc termbin.com 9999"
|
||||||
|
|
||||||
|
# the terminal rickroll
|
||||||
|
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash'
|
||||||
|
|
||||||
|
# Unlock LBRY tips
|
||||||
|
alias tips='lbrynet txo spend --type=support --is_not_my_input --blocking'
|
||||||
|
|
||||||
|
### DTOS ###
|
||||||
|
# Copy/paste all content of /etc/dtos over to home folder. A backup of config is created. (Be careful running this!)
|
||||||
|
alias dtoscopy='[ -d ~/.config ] || mkdir ~/.config && cp -Rf ~/.config ~/.config-backup-$(date +%Y.%m.%d-%H.%M.%S) && cp -rf /etc/dtos/* ~'
|
||||||
|
# Backup contents of /etc/dtos to a backup folder in $HOME.
|
||||||
|
alias dtosbackup='cp -Rf /etc/dtos ~/dtos-backup-$(date +%Y.%m.%d-%H.%M.%S)'
|
||||||
|
|
||||||
|
### RANDOM COLOR SCRIPT ###
|
||||||
|
# Get this script from my GitLab: gitlab.com/dwt1/shell-color-scripts
|
||||||
|
# Or install it from the Arch User Repository: shell-color-scripts
|
||||||
|
# colorscript random
|
||||||
|
|
||||||
|
### BASH INSULTER (works in zsh though) ###
|
||||||
|
if [ -f /etc/bash.command-not-found ]; then
|
||||||
|
. /etc/bash.command-not-found
|
||||||
|
fi
|
||||||
|
|
||||||
|
### SETTING THE STARSHIP PROMPT ###
|
||||||
|
eval "$(starship init zsh)"
|
Loading…
Reference in a new issue