come bash clarity
This commit is contained in:
399
bash/.bashrc
399
bash/.bashrc
@ -4,7 +4,35 @@ case $- in
|
|||||||
*) return;;
|
*) return;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
## Favourites ##
|
# Recursively expand alias definitions to allow for appending
|
||||||
|
## Original behaviour
|
||||||
|
# $ alias ls="ls -a"
|
||||||
|
# $ alias ls="ls -l"
|
||||||
|
# $ alias ls
|
||||||
|
# alias ls='ls -l'
|
||||||
|
## Overriden behaviour
|
||||||
|
# $ recursivelyExpandedAlias ls="ls -a"
|
||||||
|
# $ recursivelyExpandedAlias ls="ls -l"
|
||||||
|
# $ recursivelyExpandedAlias ls
|
||||||
|
# recursivelyExpandedAlias ls='ls -a -l'
|
||||||
|
function recursivelyExpandedAlias() {
|
||||||
|
KEY="${1%%=*}"
|
||||||
|
if eval "\alias '${KEY}'" &> /dev/null ; then
|
||||||
|
VALUE=${1#*=}
|
||||||
|
[ "${VALUE}" == "${KEY}" ] && (\alias "$@"; return)
|
||||||
|
LOOKUP="$(\alias ${KEY} | cut -d '=' -f 2 | cut -c 2- | rev | cut -c 2- | rev)"
|
||||||
|
VALUE="${VALUE//${KEY}/${LOOKUP}}"
|
||||||
|
\alias ${KEY}="${VALUE}"
|
||||||
|
else
|
||||||
|
\alias "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
alias alias="recursivelyExpandedAlias"
|
||||||
|
|
||||||
|
# Personal Preferences
|
||||||
|
#pragma region
|
||||||
|
### Favourites ###
|
||||||
|
#pragma region
|
||||||
export FAVCOL="green"
|
export FAVCOL="green"
|
||||||
export SECCOL="blue"
|
export SECCOL="blue"
|
||||||
export FAVCOLESC="\033[32m"
|
export FAVCOLESC="\033[32m"
|
||||||
@ -12,13 +40,44 @@ export SECCOLESC="\033[34m"
|
|||||||
export FAVCOLNUM="2"
|
export FAVCOLNUM="2"
|
||||||
export SECCOLNUM="4"
|
export SECCOLNUM="4"
|
||||||
export FAVCHAR="♞"
|
export FAVCHAR="♞"
|
||||||
|
#pragma endregion
|
||||||
|
### Default Applications ###
|
||||||
|
#pragma region
|
||||||
|
export EDITOR="vim"
|
||||||
|
export VISUAL="vim"
|
||||||
|
export BROWSER="librewolf"
|
||||||
|
export PAGER="less"
|
||||||
|
export IMAGEVIEWER="nomacs"
|
||||||
|
export MANPAGER='recursivelyExpandedAlias less'
|
||||||
|
#pragma endregion
|
||||||
|
### Quick Access ###
|
||||||
|
#pragma region
|
||||||
|
alias bashrc="${EDITOR} ${HOME}/.bashrc"
|
||||||
|
alias vimrc="${EDITOR} ${HOME}/.vimrc"
|
||||||
|
alias tmuxrc="${EDITOR} ${HOME}/.tmux.conf"
|
||||||
|
alias pufka="${EDITOR} ${MM}/pufka/pufka.cdd"
|
||||||
|
if [ "${MACHINE_NAME}" != "BATTLESTATION" ]; then
|
||||||
|
alias random="${EDITOR} ${MM}/Personal/RANDOM.outpost.txt"
|
||||||
|
else
|
||||||
|
alias random="${EDITOR} ${MM}/Personal/RANDOM.txt"
|
||||||
|
fi
|
||||||
|
alias msgbuffer="${EDITOR} ${MM}/Personal/Msg/msg.buf"
|
||||||
|
#pragma endregion
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
export BTS_L=192.168.0.206
|
# Rig
|
||||||
export ROOK_L=192.168.0.144
|
#pragma region
|
||||||
SRCF=~/.bashrc.d/
|
### Rig local IPs ###
|
||||||
|
#pragma region
|
||||||
if [[ -e ${SRCF}/MACHINE_NAME.val ]] && [[ -s ${SRCF}/MACHINE_NAME.val ]]; then
|
export BTS=192.168.0.206
|
||||||
MACHINE_NAME="$(cat ${SRCF}/MACHINE_NAME.val)"
|
export ROOK=192.168.0.144
|
||||||
|
export BLUE=192.168.0.227
|
||||||
|
#pragma endregion
|
||||||
|
### Rig Machine selection ###
|
||||||
|
#pragma region
|
||||||
|
RIGF=~/.bashrc.d/
|
||||||
|
if [[ -e ${RIGF}/MACHINE_NAME.val ]] && [[ -s ${RIGF}/MACHINE_NAME.val ]]; then
|
||||||
|
MACHINE_NAME="$(cat ${RIGF}/MACHINE_NAME.val)"
|
||||||
|
|
||||||
get_git_branch() {
|
get_git_branch() {
|
||||||
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||||
@ -53,8 +112,8 @@ if [[ -e ${SRCF}/MACHINE_NAME.val ]] && [[ -s ${SRCF}/MACHINE_NAME.val ]]; then
|
|||||||
ROOK)
|
ROOK)
|
||||||
N='\[\033[0m\]'
|
N='\[\033[0m\]'
|
||||||
B='\[\033[1m\]'
|
B='\[\033[1m\]'
|
||||||
R="\[\033[31;1m\]"
|
R='\[\033[31;1m\]'
|
||||||
G="\[\033[92;1m\]"
|
G='\[\033[92;1m\]'
|
||||||
PS1="${R}<("'${USER}@${HOSTNAME}'")>${G}-[${N}${B}"'${PWD}'"${G}]${N}$ "
|
PS1="${R}<("'${USER}@${HOSTNAME}'")>${G}-[${N}${B}"'${PWD}'"${G}]${N}$ "
|
||||||
PS2="${R}<${N} "
|
PS2="${R}<${N} "
|
||||||
|
|
||||||
@ -63,47 +122,293 @@ if [[ -e ${SRCF}/MACHINE_NAME.val ]] && [[ -s ${SRCF}/MACHINE_NAME.val ]]; then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
#pragma endregion
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
# Shell
|
||||||
|
#pragma region
|
||||||
|
### Core ###
|
||||||
|
#pragma region
|
||||||
|
shopt -s dotglob # With this set, the glob matches hidden files (".*") by default,
|
||||||
|
# but not the . or .. links.
|
||||||
|
shopt -s globstar # If set, the pattern "**" used in a pathname expansion context will
|
||||||
|
# match all files and zero or more directories and subdirectories.
|
||||||
|
shopt -s extglob # Enable additional globs. Resulting in what is effectively a Regex
|
||||||
|
# language builtin to Bash.
|
||||||
|
shopt -s checkwinsize # check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
enable -n echo
|
||||||
|
alias echo='echo -e'
|
||||||
|
|
||||||
|
IGNOREEOF=3
|
||||||
|
#pragma endregion
|
||||||
|
### History ###
|
||||||
|
#pragma region
|
||||||
|
HISTCONTROL="erasedups:ignorespace" # remove duplicates
|
||||||
|
shopt -s histappend # append to the history file, don't overwrite it
|
||||||
|
shopt -s lithist # save multiline commands with embeded newlines
|
||||||
|
HISTSIZE=10000
|
||||||
|
HISTFILESIZE=20000
|
||||||
|
HISTTIMEFORMAT='%y/%m/%d %T: '
|
||||||
|
HISTFILE="${MM}/Bash/History/.bash_history"
|
||||||
|
PROMPT_COMMAND="\history -a;$PROMPT_COMMAND"
|
||||||
|
#pragma endregion
|
||||||
|
### Charification ###
|
||||||
|
#pragma region
|
||||||
|
alias c="cd"
|
||||||
|
alias g="egrep -i"
|
||||||
|
alias s='sudo'
|
||||||
|
alias l='ls'
|
||||||
|
alias v="${EDITOR}"
|
||||||
|
alias w="personal_watch" # defined elsewhere too
|
||||||
|
alias wi="whereis"
|
||||||
|
alias cls="clear"
|
||||||
|
#pragma endregion
|
||||||
|
### Vimification ###
|
||||||
|
#pragma region
|
||||||
|
set -o vi # Turn on vi mode
|
||||||
|
|
||||||
|
alias :e="${EDITOR}"
|
||||||
|
alias :q="exit"
|
||||||
|
alias :qa="xdotool getactivewindow windowkill"
|
||||||
|
|
||||||
|
function cdvim(){
|
||||||
|
cd $(dirname $1)
|
||||||
|
vim $(basename $1)
|
||||||
|
}
|
||||||
|
|
||||||
|
alias vimcd="cdvim"
|
||||||
|
#pragma endregion
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
# Terminal
|
||||||
|
#pragma region
|
||||||
|
# [ -n "$XTERM_VERSION" ] && transset -a 0.75 &> /dev/null
|
||||||
|
stty -ixon # disable flow control and make ^S and ^Q available
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
# Path
|
||||||
|
#pragma region
|
||||||
|
export PATH="$PATH:./"
|
||||||
|
export PATH="${PATH}:${HOME}/bin/"
|
||||||
|
export PATH="${PATH}:${MM}/bin/"
|
||||||
|
|
||||||
|
export MM="/home/anon/Master"
|
||||||
|
|
||||||
|
export MKTEMPLATE_HOME="${MM}/Templates/mktemplate_home/"
|
||||||
|
export QCKSWP_SAVES="${MM}/Qckswp/.qckswp.csv"
|
||||||
|
|
||||||
|
# array of essential files
|
||||||
|
export ESSENTIALS=(
|
||||||
|
"${MM}/pufka/pufka.cdd"
|
||||||
|
"${MM}/Personal/quotes.txt"
|
||||||
|
"${MM}/Personal/Notes/jelszo"
|
||||||
|
"${MM}/Peak/peak.cdd"
|
||||||
|
"${MM}/s/процесс.log"
|
||||||
|
)
|
||||||
|
|
||||||
|
# array of personal config files/directories
|
||||||
|
export RCCONFIG=(
|
||||||
|
"${MM}/Bash/Bashrc/"
|
||||||
|
"${MM}/Vim/Vimrc/"
|
||||||
|
"${MM}/Tmux/Tmuxrc/.tmux.conf"
|
||||||
|
"${MM}/ImageBoards/Storage/"
|
||||||
|
"${MM}/Personal/Wallpaper/"
|
||||||
|
"$MKTEMPLATE_HOME"
|
||||||
|
"$QCKSWP_SAVES"
|
||||||
|
"$LISTAHOME"
|
||||||
|
"${MM}/Fonts/figlet-fonts/"
|
||||||
|
)
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
# Programs
|
||||||
|
#pragma region
|
||||||
|
### Verbosity ###
|
||||||
|
#pragma region
|
||||||
|
alias cp='cp -v'
|
||||||
|
alias mv='mv -v'
|
||||||
|
alias rm='rm -v'
|
||||||
|
alias tar='tar -v'
|
||||||
|
alias gzip='gzip -v'
|
||||||
|
alias bc='bc -q'
|
||||||
|
alias gdb='gdb -q'
|
||||||
|
#pragma endregion
|
||||||
|
### Color ###
|
||||||
|
#pragma region
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias diff='diff -s -y -t --color=auto' # report identical; side-by-side; expand tabs; color
|
||||||
|
alias dir='dir --color=auto'
|
||||||
|
alias vdir='vdir --color=auto'
|
||||||
|
alias df='df --print-type'
|
||||||
|
alias ip='ip --color=auto'
|
||||||
|
alias tshark='tshark --color'
|
||||||
|
alias bat='bat --italic-text always'
|
||||||
|
alias hexedit='hexedit --color'
|
||||||
|
alias less='less --use-color'
|
||||||
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||||
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
|
[ -n "$LS_COLORS" ] || (test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)")
|
||||||
|
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
|
||||||
|
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
|
||||||
|
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
|
||||||
|
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
|
||||||
|
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
|
||||||
|
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
|
||||||
|
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
|
||||||
|
fi
|
||||||
|
#pragma endregion
|
||||||
|
### Safety ###
|
||||||
|
#pragma region
|
||||||
|
alias wget='wget --restrict-file-names=windows,ascii'
|
||||||
|
alias rm='rm -I'
|
||||||
|
alias yt-dlp='yt-dlp --restrict-filenames --no-overwrites'
|
||||||
|
alias wgetpaste='wgetpaste -s 0x0'
|
||||||
|
#pragma endregion
|
||||||
|
### Unsafety ###
|
||||||
|
#pragma region
|
||||||
|
alias curl='curl --insecure'
|
||||||
|
alias mkdir='mkdir -p'
|
||||||
|
#pragma endregion
|
||||||
|
#### Formatting ####
|
||||||
|
#pragma region
|
||||||
|
alias lsblk='lsblk -o LABEL,NAME,SIZE,FSUSE%,RM,RO,TYPE,FSTYPE,MOUNTPOINTS'
|
||||||
|
alias hgrep='\history | grep'
|
||||||
|
alias history='history | tail -n 10'
|
||||||
|
alias clear="clear; env echo -e \"${FAVCOLESC}###\033[0m\"; dirs"
|
||||||
|
alias cal='cal --monday'
|
||||||
|
alias nmap='nmap --stats-every 5s'
|
||||||
|
#pragma endregion
|
||||||
|
### Controls / Interfaces ###
|
||||||
|
#pragma region
|
||||||
|
alias gdb='gdb --tui'
|
||||||
|
alias bat='bat --paging=never'
|
||||||
|
alias less='less --mouse'
|
||||||
|
alias info='info --vi-keys'
|
||||||
|
#pragma endregion
|
||||||
|
### Per program ###
|
||||||
|
#pragma region
|
||||||
|
##### ls ####
|
||||||
|
alias ls='ls -aF --color=auto'
|
||||||
|
alias ll='l -l'
|
||||||
|
##### bc ####
|
||||||
|
alias bc='bc -l'
|
||||||
|
##### nnn ####
|
||||||
|
nnn_cd() {
|
||||||
|
if ! [ -z "$NNN_PIPE" ]; then
|
||||||
|
printf "%s\0" "0c${PWD}" > "${NNN_PIPE}" !&
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap nnn_cd EXIT
|
||||||
|
alias n="nnn"
|
||||||
|
##### qckcmd ####
|
||||||
|
function qckcmd_wrapper(){
|
||||||
|
READLINE_LINE="$(qckcmd -i ~/.qckcmd)"
|
||||||
|
READLINE_POINT="${#READLINE_LINE}"
|
||||||
|
}
|
||||||
|
bind -x '"\C-p": qckcmd_wrapper'
|
||||||
|
#bind -x '"\C-p": eval $(qckcmd -i ~/.qckcmd)'
|
||||||
|
##### whereis ####
|
||||||
|
function whereisAlias(){
|
||||||
|
\whereis $@ | awk -F ': ' -v OFS="" '{$1=""; print}'
|
||||||
|
}
|
||||||
|
alias whereis='whereisAlias'
|
||||||
|
##### Mysql ####
|
||||||
|
export MYSQL_PS1=$(env echo -e "\033[1;32m#\033[34m\\U\033[0;1m:\033[32m[\033[0m\\d\033[1;32m]>\033[0m\\_")
|
||||||
|
MYCLI_PS1=${MYSQL_PS1//\\U/\\u}
|
||||||
|
alias mycli="mycli --prompt \"${MYCLI_PS1}\""
|
||||||
|
alias mysql="mysql --user=${USER} -p"
|
||||||
|
##### gpg ####
|
||||||
|
GPG_TTY=$(tty)
|
||||||
|
export GPG_TTY
|
||||||
|
export PINENTRY_USER_DATA='USE_CURSES=1'
|
||||||
|
alias gpg='gpg -i --no-symkey-cache'
|
||||||
|
##### Lynx ####
|
||||||
|
export WWW_HOME="${HOME}/lynx_bookmarks.html"
|
||||||
|
##### locate ####
|
||||||
|
alias locatei='locate -i'
|
||||||
|
##### figlet ####
|
||||||
|
alias figlet="figlet -w 120 -d ${MM}/Fonts/figlet-fonts/"
|
||||||
|
##### fzf ####
|
||||||
|
export FZF_DEFAULT_OPTS='--multi --no-mouse --height=10 --layout=reverse'
|
||||||
|
##### tmux ####
|
||||||
|
alias tmux='tmux new-session -t '0' || tmux'
|
||||||
|
#pragma endregion
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
# Personal
|
|
||||||
source ${SRCF}/def_apps.rc
|
|
||||||
source ${SRCF}/paths.rc
|
|
||||||
# Bash behaviour setting
|
|
||||||
source ${SRCF}/builtin.rc
|
|
||||||
source ${SRCF}/glob.rc
|
|
||||||
source ${SRCF}/winsize.rc
|
|
||||||
source ${SRCF}/ignoreeof.rc
|
|
||||||
# Program looks
|
|
||||||
source ${SRCF}/program_looks.rc
|
|
||||||
# Core behavour settings
|
|
||||||
source ${SRCF}/core.rc
|
|
||||||
# Core behavour overriding
|
|
||||||
source ${SRCF}/history.rc
|
|
||||||
source ${SRCF}/cd.rc
|
|
||||||
# Periphery behaviour setting
|
|
||||||
source ${SRCF}/gpg.rc
|
|
||||||
source ${SRCF}/sudo.rc
|
|
||||||
# Short cutting
|
|
||||||
source ${SRCF}/alias.rc
|
|
||||||
source ${SRCF}/vimification.rc
|
|
||||||
source ${SRCF}/signin.rc
|
|
||||||
# Tab completion
|
|
||||||
source ${SRCF}/completion.rc
|
|
||||||
# Widgets
|
|
||||||
source ${SRCF}/neofetch.rc
|
|
||||||
source ${SRCF}/w.rc # watch (clock)
|
|
||||||
source ${SRCF}/bash_fzfind.rc
|
|
||||||
source ${SRCF}/nnn.rc
|
|
||||||
# Languages
|
# Languages
|
||||||
source ${SRCF}/rust.rc
|
#pragma region
|
||||||
source ${SRCF}/go.rc
|
### Go ###
|
||||||
source ${SRCF}/perl.rc
|
#pragma region
|
||||||
source ${SRCF}/python.rc
|
export PATH="${PATH}:~/go/bin/"
|
||||||
source ${SRCF}/java.rc
|
#pragma endregion
|
||||||
source ${SRCF}/csharp.rc
|
### Perl ###
|
||||||
# Misc
|
#pragma region
|
||||||
source ${SRCF}/binds.rc
|
export PERL5LIB="$PERL5LIB:."
|
||||||
source ${SRCF}/xterm.rc
|
#pragma endregion
|
||||||
|
### Python ###
|
||||||
|
#pragma region
|
||||||
|
alias ipython="ipython -i ${MM}/Python/Pythonrc/init.py"
|
||||||
|
alias vsource='source ./venv/bin/activate'
|
||||||
|
#pragma endregion
|
||||||
|
### Java ###
|
||||||
|
#pragma region
|
||||||
|
export SDKMAN_DIR="$HOME/.sdkman"
|
||||||
|
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||||
|
#pragma endregion
|
||||||
|
### C# ###
|
||||||
|
#pragma region
|
||||||
|
export MCS_COLORS='brightwhite,red'
|
||||||
|
#pragma endregion
|
||||||
|
### Pust ###
|
||||||
|
#pragma region
|
||||||
|
export PATH="${PATH}:~/.cargo/bin/"
|
||||||
|
#pragma endregion
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
# Custom Additions
|
||||||
|
#pragma region
|
||||||
function ffgrep() {
|
function ffgrep() {
|
||||||
fgrep "$1" ./**/* 2> /dev/null
|
fgrep "$1" ./**/* 2> /dev/null
|
||||||
}
|
}
|
||||||
|
function signin(){
|
||||||
|
\sudo -u $1 bash
|
||||||
|
}
|
||||||
|
alias cbash='bash --norc --noprofile --init-file <(echo "unset HISTFILE")'
|
||||||
|
alias resource='source /home/anon/.bashrc'
|
||||||
|
alias xclip='xclip -selection clipboard'
|
||||||
|
alias tt='tt_with_high_score.sh'
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
|
# Plugins
|
||||||
|
SRCF=~/.bashrc.d/
|
||||||
|
source ${SRCF}/w.rc # watch (clock)
|
||||||
|
source ${SRCF}/cd.rc
|
||||||
|
source ${SRCF}/sudo.rc
|
||||||
|
source ${SRCF}/fzfind.rc
|
||||||
|
source ${SRCF}/ls_colors.rc
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$USER" == "root" ]; then
|
||||||
|
printf "${FAVCOLESC}
|
||||||
|
()
|
||||||
|
.-:--:-.
|
||||||
|
\____/
|
||||||
|
{====}
|
||||||
|
)__(
|
||||||
|
/____\
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
/____\
|
||||||
|
(======)
|
||||||
|
}======{
|
||||||
|
(________)
|
||||||
|
|
||||||
|
\033[0m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
alias xclip='xclip -selection clipboard'
|
|
||||||
# Ease of use
|
|
||||||
# single char
|
|
||||||
alias c="cd"
|
|
||||||
alias g="egrep -i"
|
|
||||||
alias s='sudo'
|
|
||||||
alias l='ls'
|
|
||||||
alias v="${EDITOR}"
|
|
||||||
alias w="personal_watch" # defined else where too
|
|
||||||
# Two char
|
|
||||||
alias wi="whereis"
|
|
||||||
# # #
|
|
||||||
alias cbash='bash --norc --noprofile --init-file <(echo "unset HISTFILE")'
|
|
||||||
alias history='history | tail -n 10'
|
|
||||||
alias cls="clear; env echo -e \"${FAVCOLESC}###\033[0m\"; dirs"
|
|
||||||
alias mkdir="mkdir -p"
|
|
||||||
alias hgrep="\\history | grep"
|
|
||||||
alias quit="exit"
|
|
||||||
alias figlet="figlet -w 120 -d ${MM}/Fonts/figlet-fonts/"
|
|
||||||
alias heavyDuty=". ${MM}/Bash/Bashrc/.heavyDutyrc"
|
|
||||||
alias locatei="locate -i"
|
|
||||||
alias resource="source /home/anon/.bashrc"
|
|
||||||
alias mysql="mysql --user=${USER} -p"
|
|
||||||
alias tmux="export LINES=${LINES}; export COLUMNS=${COLUMNS}; tmux new-session -t '0' || tmux"
|
|
||||||
alias wgetpaste="wgetpaste -s 0x0"
|
|
||||||
alias info="info --vi-keys"
|
|
||||||
alias less="less --mouse"
|
|
||||||
# Safety
|
|
||||||
alias wget='wget --restrict-file-names=windows,ascii'
|
|
||||||
alias rm='rm -I'
|
|
||||||
alias gpg='gpg -i --no-symkey-cache'
|
|
||||||
alias yt-dlp='yt-dlp --restrict-filenames --no-overwrites'
|
|
||||||
# Unsafety
|
|
||||||
alias curl='curl --insecure'
|
|
||||||
# Quick access
|
|
||||||
alias tt="tt_with_high_score.sh"
|
|
||||||
alias txt="vim \"${MM}/C++/pufka.cdd\" \"${MM}/Personal/RANDOM.txt\" \"${MM}/Archive/text/a_self-made/quotes.txt\" \"${MM}/Peak/peak.cdd\" \"${MM}/s/процесс.log\""
|
|
||||||
# Files with editor
|
|
||||||
alias bashrc="${EDITOR} ${HOME}/.bashrc"
|
|
||||||
alias vimrc="${EDITOR} ${HOME}/.vimrc"
|
|
||||||
alias tmuxrc="${EDITOR} ${HOME}/.tmux.conf"
|
|
||||||
alias pufka="${EDITOR} ${MM}/pufka/pufka.cdd"
|
|
||||||
if [ "${MACHINE_NAME}" != "BATTLESTATION" ]; then
|
|
||||||
alias random="${EDITOR} ${MM}/Personal/RANDOM.outpost.txt"
|
|
||||||
else
|
|
||||||
alias random="${EDITOR} ${MM}/Personal/RANDOM.txt"
|
|
||||||
fi
|
|
||||||
alias msgbuffer="${EDITOR} ${MM}/Personal/Msg/msg.buf"
|
|
@ -1,8 +0,0 @@
|
|||||||
function qckcmd_wrapper(){
|
|
||||||
READLINE_LINE="$(qckcmd -i ~/.qckcmd)"
|
|
||||||
READLINE_POINT="${#READLINE_LINE}"
|
|
||||||
}
|
|
||||||
bind -x '"\C-p": qckcmd_wrapper'
|
|
||||||
#bind -x '"\C-p": eval $(qckcmd -i ~/.qckcmd)'
|
|
||||||
#bind -x '"\C-~": cd ~'
|
|
||||||
#bind -x '"\C-h": history'
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
enable -n echo
|
|
16
bash/.bashrc.d/cd.rc
Normal file → Executable file
16
bash/.bashrc.d/cd.rc
Normal file → Executable file
@ -1,10 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Plugin: cd_rc
|
||||||
|
# Description: Replaces vanilla cd with the Bash Directory Stack with custom formatting and defines common directory changing settings.
|
||||||
|
# Author: Anon
|
||||||
|
# Date: 2024
|
||||||
|
# Version: 1.0
|
||||||
|
# Source:
|
||||||
|
# mirror 1: http://bis64wqhh3louusbd45iyj76kmn4rzw5ysawyan5bkxwyzihj67c5lid.onion/anon/cd_rc
|
||||||
|
# mirror 2: https://github.com/agvxov/cd_rc.git
|
||||||
|
|
||||||
alias cd="PushdAlias"
|
alias cd="PushdAlias"
|
||||||
|
alias popd="PopdAlias"
|
||||||
|
alias dirs="DirsAlias"
|
||||||
alias cdh="cd ~"
|
alias cdh="cd ~"
|
||||||
alias cdu="cdUp"
|
alias cdu="cdUp"
|
||||||
alias pop="popd"
|
alias pop="popd"
|
||||||
alias popd="PopdAlias"
|
|
||||||
alias dirs="DirsAlias"
|
alias cd..="cd .." # people like this for some reason
|
||||||
|
|
||||||
function mkdircd() {
|
function mkdircd() {
|
||||||
mkdir -p "$@" && eval cd "\"\$$#\"";
|
mkdir -p "$@" && eval cd "\"\$$#\"";
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#source ~/.sdkman/candidates/springboot/current/shell-completion/bash/spring
|
|
@ -1,3 +0,0 @@
|
|||||||
alias bc="bc -l"
|
|
||||||
stty -ixon # disable flow control and make ^S and ^Q available
|
|
||||||
export MANPAGER='less --mouse'
|
|
@ -1 +0,0 @@
|
|||||||
export MCS_COLORS="brightwhite,red"
|
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
## DEFAULT APPLICATIONS ##
|
|
||||||
export EDITOR="vim"
|
|
||||||
export VISUAL="vim"
|
|
||||||
export BROWSER="librewolf"
|
|
||||||
export PAGER="less"
|
|
||||||
export IMAGEVIEWER="nomacs"
|
|
98
bash/.bashrc.d/fzfind.rc
Executable file
98
bash/.bashrc.d/fzfind.rc
Executable file
@ -0,0 +1,98 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Plugin: fzfing
|
||||||
|
# Description: fzf based file fuzzy finder for Bash
|
||||||
|
# Author: Anon
|
||||||
|
# Date: 2024
|
||||||
|
# Version: 1.0
|
||||||
|
# Source:
|
||||||
|
# mirror 1: http://bis64wqhh3louusbd45iyj76kmn4rzw5ysawyan5bkxwyzihj67c5lid.onion/anon/fzfind
|
||||||
|
# mirror 2: https://github.com/agvxov/fzfind
|
||||||
|
|
||||||
|
|
||||||
|
[ -z "$CTRLFMODE" ] && CTRLFMODE="path"
|
||||||
|
[ -z "$CTRLFMETHOD" ] && CTRLFMETHOD="find"
|
||||||
|
#CTRLCACHE="/home/anon/Desktop/"
|
||||||
|
|
||||||
|
function ctrl_f_mode(){
|
||||||
|
read -n 1 M
|
||||||
|
case $M in
|
||||||
|
p) CTRLFMODE="path";;
|
||||||
|
u) CTRLFMODE="user";;
|
||||||
|
o) CTRLFMODE="opt";;
|
||||||
|
c) CTRLFMODE="cmd" ;;
|
||||||
|
v) CTRLFMODE="var" ;;
|
||||||
|
*) CTRLFMODE="path";;
|
||||||
|
esac
|
||||||
|
env echo -e "\033[1mctrl-f mode: \"\033[0m${CTRLFMODE}\""
|
||||||
|
}
|
||||||
|
function echo_readline_line(){
|
||||||
|
PS1_CLEANED="${PS1//\\\[/}"
|
||||||
|
PS1_CLEANED="${PS1_CLEANED//\\\]/}"
|
||||||
|
env echo -e "${PS1_CLEANED}${1:0:${2}}\033[45m \033[0m${1:${2}}"
|
||||||
|
#env echo -e "${PS1}${1:0:${2}}\033[45m \033[0m${1:${2}}"
|
||||||
|
}
|
||||||
|
function ctrl_f(){
|
||||||
|
# Show command and substitution position
|
||||||
|
echo_readline_line "${READLINE_LINE}" "${READLINE_POINT}"
|
||||||
|
# Get narrowing substring
|
||||||
|
OPX=""
|
||||||
|
if [ "${READLINE_LINE:$(expr $READLINE_POINT - 1):1}" != " " ]; then
|
||||||
|
OPX=$(lastWord "${READLINE_LINE:0:${READLINE_POINT}}")
|
||||||
|
fi
|
||||||
|
#echo "'$PX'"
|
||||||
|
# Decide possible completions and use fzf for selection
|
||||||
|
case $CTRLFMODE in
|
||||||
|
"path")
|
||||||
|
if [ $CTRLFMETHOD == "find" ]; then
|
||||||
|
PX="$OPX"
|
||||||
|
STR=$(eval find ./"$PX/" 2> /dev/null | fzf --multi=1)
|
||||||
|
elif [ $CTRLFMETHOD == "locate" ]; then
|
||||||
|
PX="$(realpath $PWD/$OPX)"
|
||||||
|
STR=$(eval locate --existing --regex $PX/'.*' 2> /dev/null | fzf --multi=1)
|
||||||
|
else
|
||||||
|
echo -e "\033[31;1mNonsensical \033[34;1m\${CTRLFMETHOD} \033[31;1mvalue.\033[0m"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"opt")
|
||||||
|
#get command
|
||||||
|
#check catche
|
||||||
|
#parse
|
||||||
|
;;
|
||||||
|
"user")
|
||||||
|
if [ "$PX" != "" ]; then
|
||||||
|
STR="$(compgen -u ${PX} | fzf --multi=1)"
|
||||||
|
else
|
||||||
|
STR="$(compgen -u | fzf --multi=1)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"cmd")
|
||||||
|
if [ "$PX" != "" ]; then
|
||||||
|
STR="$(compgen -c ${PX} | uniq | fzf --multi=1)"
|
||||||
|
else
|
||||||
|
STR="$(compgen -c | uniq | fzf --multi=1)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"var")
|
||||||
|
if [ "$PX" != "" ]; then
|
||||||
|
STR="$(compgen -v ${PX} | fzf --multi=1)"
|
||||||
|
else
|
||||||
|
STR="$(compgen -v | fzf --multi=1)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Remove ${PX}
|
||||||
|
STR="${STR/${PX}/}"
|
||||||
|
# Write $READLINE_LINE
|
||||||
|
[ -z "$STR" ] && return
|
||||||
|
if [ "$CTRLFMODE" == "path" ]; then # quote paths
|
||||||
|
READLINE_LINE="${READLINE_LINE:0:$(expr ${READLINE_POINT} - ${#OPX})}\"${OPX}${STR}\"${READLINE_LINE:${READLINE_POINT}}" # start_til_px + '"' + px + str '"' + rest
|
||||||
|
READLINE_POINT=$(expr ${READLINE_POINT} + ${#OPX} + ${#STR} + 2) # +2 for the '"'s
|
||||||
|
else
|
||||||
|
READLINE_LINE="${READLINE_LINE:0:$(expr ${READLINE_POINT} - ${#OPX})}${OPX}${STR}${READLINE_LINE:${READLINE_POINT}}" # start_til_px + px + str + rest
|
||||||
|
READLINE_POINT=$(expr ${READLINE_POINT} + ${#OPX} + ${#STR})
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
bind -x '"\C-e": ctrl_f_mode'
|
||||||
|
bind -x '"\C-f": ctrl_f'
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
shopt -s dotglob # With this set, the glob matches hidden files (".*") by default,
|
|
||||||
# but not the . or .. links.
|
|
||||||
shopt -s globstar # If set, the pattern "**" used in a pathname expansion context will
|
|
||||||
# match all files and zero or more directories and subdirectories.
|
|
||||||
shopt -s extglob # Enable additional globs. Resulting in what is effectively a Regex
|
|
||||||
# language builtin to Bash.
|
|
@ -1 +0,0 @@
|
|||||||
export PATH="${PATH}:~/go/bin/"
|
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
GPG_TTY=$(tty)
|
|
||||||
export GPG_TTY
|
|
||||||
export PINENTRY_USER_DATA="USE_CURSES=1"
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
HISTCONTROL=erasedups # remove duplicates
|
|
||||||
shopt -s histappend # append to the history file, don't overwrite it
|
|
||||||
shopt -s lithist # save multiline commands with embeded newlines
|
|
||||||
HISTSIZE=10000
|
|
||||||
HISTFILESIZE=20000
|
|
||||||
HISTTIMEFORMAT='%y/%m/%d %T: '
|
|
||||||
HISTFILE="${MM}/Bash/History/.bash_history"
|
|
||||||
PROMPT_COMMAND="\history -a;$PROMPT_COMMAND"
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
IGNOREEOF=3
|
|
@ -1,2 +0,0 @@
|
|||||||
export SDKMAN_DIR="$HOME/.sdkman"
|
|
||||||
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
|
|
3
bash/.bashrc.d/ls_colors.rc
Normal file
3
bash/.bashrc.d/ls_colors.rc
Normal file
File diff suppressed because one or more lines are too long
@ -1,24 +0,0 @@
|
|||||||
[ "$USER" == "anon" ] && return
|
|
||||||
|
|
||||||
if [ "$USER" == "root" ]; then
|
|
||||||
printf "${FAVCOLESC}
|
|
||||||
()
|
|
||||||
.-:--:-.
|
|
||||||
\____/
|
|
||||||
{====}
|
|
||||||
)__(
|
|
||||||
/____\
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
/____\
|
|
||||||
(======)
|
|
||||||
}======{
|
|
||||||
(________)
|
|
||||||
|
|
||||||
\033[0m"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
neofetch
|
|
@ -1,10 +0,0 @@
|
|||||||
nnn_cd()
|
|
||||||
{
|
|
||||||
if ! [ -z "$NNN_PIPE" ]; then
|
|
||||||
printf "%s\0" "0c${PWD}" > "${NNN_PIPE}" !&
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
trap nnn_cd EXIT
|
|
||||||
|
|
||||||
alias n="nnn"
|
|
@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
export PATH="$PATH:./"
|
|
||||||
export PATH="${PATH}:${HOME}/bin/"
|
|
||||||
export PATH="${PATH}:${MM}/bin/"
|
|
||||||
|
|
||||||
export MM="/home/anon/Master"
|
|
||||||
|
|
||||||
export MKTEMPLATE_HOME="${MM}/Templates/mktemplate_home/"
|
|
||||||
export QCKSWP_SAVES="${MM}/Qckswp/.qckswp.csv"
|
|
||||||
|
|
||||||
# array of essential files
|
|
||||||
export ESSENTIALS=(
|
|
||||||
"${MM}/pufka/pufka.cdd"
|
|
||||||
"${MM}/Personal/quotes.txt"
|
|
||||||
"${MM}/Personal/Notes/jelszo"
|
|
||||||
"${MM}/Peak/peak.cdd"
|
|
||||||
"${MM}/s/процесс.log"
|
|
||||||
)
|
|
||||||
|
|
||||||
# array of personal config files/directories
|
|
||||||
export RCCONFIG=(
|
|
||||||
"${MM}/Bash/Bashrc/"
|
|
||||||
"${MM}/Vim/Vimrc/"
|
|
||||||
"${MM}/Tmux/Tmuxrc/.tmux.conf"
|
|
||||||
"${MM}/ImageBoards/Storage/"
|
|
||||||
"${MM}/Personal/Wallpaper/"
|
|
||||||
"$MKTEMPLATE_HOME"
|
|
||||||
"$QCKSWP_SAVES"
|
|
||||||
"$LISTAHOME"
|
|
||||||
"${MM}/Fonts/figlet-fonts/"
|
|
||||||
)
|
|
||||||
|
|
||||||
# start page for lynx and possibly other browsers
|
|
||||||
export WWW_HOME="${HOME}/lynx_bookmarks.html"
|
|
@ -1,58 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Enable color support of ls, less and man, and also add handy aliases
|
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
||||||
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
|
|
||||||
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
|
|
||||||
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
|
|
||||||
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
|
|
||||||
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
|
|
||||||
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
|
|
||||||
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
|
|
||||||
fi
|
|
||||||
|
|
||||||
### VARIABLE BASED ###
|
|
||||||
# mysql #
|
|
||||||
export MYSQL_PS1=$(env echo -e "\033[1;32m#\033[34m\\U\033[0;1m:\033[32m[\033[0m\\d\033[1;32m]>\033[0m\\_")
|
|
||||||
MYCLI_PS1=${MYSQL_PS1//\\U/\\u}
|
|
||||||
# gcc #
|
|
||||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
|
||||||
# fzf #
|
|
||||||
export FZF_DEFAULT_OPTS="--multi --no-mouse --height=10 --layout=reverse"
|
|
||||||
|
|
||||||
### ALIAS BASED ###
|
|
||||||
# Core
|
|
||||||
alias ls="\ls -aF --color=auto"
|
|
||||||
alias ll='l -l'
|
|
||||||
alias cp='cp -v'
|
|
||||||
alias mv='mv -v'
|
|
||||||
alias rm='rm -v'
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
alias fgrep='fgrep --color=auto'
|
|
||||||
alias egrep='egrep --color=auto'
|
|
||||||
alias echo='echo -e'
|
|
||||||
alias whereis='whereisAlias'
|
|
||||||
alias diff='diff -s -y -t --color=auto' # report identical; side-by-side; expand tabs; color
|
|
||||||
alias dir='dir --color=auto'
|
|
||||||
alias vdir='vdir --color=auto'
|
|
||||||
alias lsblk='lsblk -o LABEL,NAME,SIZE,FSUSE%,RM,RO,TYPE,FSTYPE,MOUNTPOINTS'
|
|
||||||
alias df='df --print-type'
|
|
||||||
alias ip='ip --color=auto'
|
|
||||||
# GNU
|
|
||||||
alias less='less --use-color'
|
|
||||||
alias cal='cal --monday'
|
|
||||||
alias tar='tar -v'
|
|
||||||
alias gzip='gzip -v'
|
|
||||||
alias gdb='gdb -q --tui'
|
|
||||||
alias bc="bc -q"
|
|
||||||
# Misc.
|
|
||||||
alias hexedit='hexedit --color'
|
|
||||||
alias bat='bat --paging=never --italic-text always'
|
|
||||||
alias tshark='tshark --color'
|
|
||||||
alias mycli="mycli --prompt \"${MYCLI_PS1}\""
|
|
||||||
alias neofetch="neofetch --ascii ${MM}/Neofetch/${USER}.ascii --ascii_colors 15 ${FAVCOLNUM} ${SECCOLNUM}"
|
|
||||||
|
|
||||||
### OVERRIDE FUNCTIONS ###
|
|
||||||
function whereisAlias(){
|
|
||||||
\whereis $@ | awk -F ': ' -v OFS="" '{$1=""; print}'
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
alias ipython="ipython -i ${MM}/Python/Pythonrc/init.py"
|
|
||||||
alias vsource="source ./venv/bin/activate"
|
|
@ -1 +0,0 @@
|
|||||||
export PATH="${PATH}:~/.cargo/bin/"
|
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
function signin(){
|
|
||||||
\sudo -u $1 bash
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -o vi # Turn on vi mode
|
|
||||||
|
|
||||||
alias :e="${EDITOR}"
|
|
||||||
alias :q="exit"
|
|
||||||
alias :qa="xdotool getactivewindow windowkill"
|
|
||||||
|
|
||||||
function cdvim(){
|
|
||||||
cd $(dirname $1)
|
|
||||||
vim $(basename $1)
|
|
||||||
}
|
|
||||||
|
|
||||||
alias vimcd="cdvim"
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
shopt -s checkwinsize # check the window size after each command and, if necessary,
|
|
||||||
# update the values of LINES and COLUMNS.
|
|
@ -1 +0,0 @@
|
|||||||
# [ -n "$XTERM_VERSION" ] && transset -a 0.75 &> /dev/null
|
|
Reference in New Issue
Block a user