remove bash

This commit is contained in:
thek4n 2024-11-02 12:53:43 +03:00
parent d1c1287399
commit 7f66492f2a
17 changed files with 158 additions and 358 deletions

View File

@ -1,8 +1,7 @@
declare -r -A TARGETS=( declare -r -A TARGETS=(
["colors"]=".config/terminal-colors.d" ["colors"]=".config/terminal-colors.d"
["tmux"]=".config/tmux .tmux .config/systemd/user/tmux.service .local/bin/tmux_start_session.sh .local/bin/tmux_list_sessions.sh .local/bin/tmux_attach_session.sh .local/bin/tmux_kill_sessions.sh" ["tmux"]=".config/tmux .tmux .config/systemd/user/tmux.service .local/bin/tmux_start_session.sh .local/bin/tmux_list_sessions.sh .local/bin/tmux_attach_session.sh .local/bin/tmux_kill_sessions.sh"
["bash"]=".config/bash .bashrc .profile %tmux %colors" ["zsh"]=".config/zsh .zshenv .inputrc %colors"
["zsh"]="%bash .config/zsh .zshenv .inputrc"
["alacritty"]=".config/alacritty" ["alacritty"]=".config/alacritty"
["nvim"]=".config/nvim .editorconfig .inputrc .editrc .local/bin/vim_askpass_helper" ["nvim"]=".config/nvim .editorconfig .inputrc .editrc .local/bin/vim_askpass_helper"
["ssh"]="" ["ssh"]=""

View File

@ -1,5 +0,0 @@
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc

View File

@ -1,26 +0,0 @@
alias l.='ls -AF --ignore="*"'
alias ll='ls -lhF'
alias la='ls -AF'
alias lt='du -sh * | sort -h'
alias rm='rm -ir'
alias mkdir='mkdir -pv'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias .3='cd ../../..'
alias path='echo -e ${PATH//:/\\n}'
# shorts
alias c='clear'
alias q='exit'
alias h='history | less'
alias j='jobs -l'
# utils
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
PS1="\n┌──(\u@\H)-[\w]\n└─\$ "

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
# https://github.com/TheK4n/dotfiles
if \
[ "$(tty)" != "/dev/tty3" ] && \
command -v tmux &>/dev/null && \
[ -z "$TMUX" ] && \
tmux -N -L "$USER" list-sessions &>/dev/null
then
exec tmux -N -L "$USER" new-session
fi
if [ -f "$HOME/.config/bash/sourcer" ]; then
source "$HOME/.config/bash/sourcer"
fi
if \
command -v tmux &>/dev/null && \
[ -n "$TMUX" ] && \
[ -n "$SSH_CLIENT" ]
then
tmux source-file "$XDG_CONFIG_HOME/tmux/remote.conf"
fi

View File

@ -1,140 +0,0 @@
# vim: ft=bash
_d() { true ; }
_f() { true ; }
# colors
if [ -x "$(command -v dircolors)" ]; then
export LS_OPTIONS="--color=auto"
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias grep='grep $LS_OPTIONS'
alias fgrep='fgrep $LS_OPTIONS'
alias ls='ls -v $LS_OPTIONS'
fi
alias l.='ls -AFv --ignore="*"'
alias ll='ls -lhFv'
alias la='ls -AFv'
alias lla='ls -lhFAv'
alias ll.='ls -lhFAv --ignore="*"'
alias lsl='_d() { ls -lhFA --color=always "${1:-.}" | $PAGER ; }; _d'
alias _='sudo'
alias root='sudo -i TMOUT=450'
alias rm='rm -Ivr --one-file-system'
alias mkdir='mkdir -pv'
alias cl='_d() { cd "${1:-$HOME}" && ls; }; _d'
alias q='exit 0'
alias wp='cd "$WORKING_PROJECT"'
alias path='echo -e ${PATH//:/\\n}'
alias dh='dirs -v'
alias pd='popd'
# shorts
alias c='clear'
alias h='history 0'
alias j='jobs -l'
# utils
alias sha='(shasum -a 256 | head -c 64)'
alias genpass="openssl rand -base64 12"
alias gensalt="dd if=/dev/urandom count=16 2>/dev/null | sha256sum | head -c 64"
alias diff='colordiff'
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man'
# time
alias now='date +"%T"'
alias nowdate='date +"%d-%m-%Y"'
alias cal='cal -m'
alias beeptime='beep -D 400 -l 400 -r "$(date +%I)" -f 440 -n -D 1000 -l 0 -n -D 800 -l 200 -f 880 -r "$(($(date +%M)/15))"'
# vim
alias vi='nvim'
alias svi="sudo -E nvim"
# net
alias ports='ss -tlnp'
alias wget='wget -c'
# alias myip='curl ipinfo.io/ip'
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
alias sprunge='curl -F "sprunge=<-" http://sprunge.us 2>/dev/null' # CLI pastebin
alias weather='(curl -4 wttr.in/$(cat) 2>/dev/null | head -n -1) <<<'
alias ip='ip -c'
alias fastping='ping -c 100 -i 0.1'
# starts web server
alias www='python3 -m http.server 8080'
# hardware
alias reboot='sudo /sbin/reboot'
alias poweroff='sudo /sbin/poweroff'
alias suspend='sudo systemctl suspend'
alias halt='sudo /sbin/halt'
alias shutdown='sudo /sbin/shutdown now'
alias meminfo='free -mlth'
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
alias wake='((speaker-test -t sine -f 400 &>/dev/null)& local pid=$! ;sleep 0.2s; kill -9 $pid) &>/dev/null'
elif [[ "$OSTYPE" == "linux-android"* ]]; then
alias wake='termux-notification --sound --vibrate 500,1000,200'
fi
# python
alias pipir='pip install -r requirements.txt'
alias pipar='pip list --not-required --format freeze | tee requirements.txt'
alias vd='deactivate'
# git
alias watch-diff='watch --color "git diff --color=always"'
# docker
alias dcu='docker-compose up -d'
alias dcd='docker-compose down'
alias drmc='docker container prune'
alias drmi='docker image prune'
# tmux
alias dt='tmux detach'
# x11
alias caps='xdotool key Caps_Lock'
alias CAPS='xdotool key Caps_Lock'
alias colors='for i in {0..255}; do printf "\x1b[38;5;${i}mcolor${i} - ██████████\n"; done'
# clipboard
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ -n "$DISPLAY" ]]; then
alias copy='xclip -selection clipboard -i'
alias paste='xclip -selection clipboard -o'
else
alias copy='read -rd "EOF" TTYCLIPBOARD'
alias paste='echo "$TTYCLIPBOARD"'
fi
elif [[ "$OSTYPE" == "linux-android"* ]]; then
alias copy='termux-clipboard-set'
alias paste='termux-clipboard-get'
elif [[ "$OSTYPE" == "darwin" ]]; then
alias copy='pbcopy'
alias paste='pbpaste'
fi
alias sshn='ssh -S none'
alias black='magick canvas:none PNG:- | feh -YF -'
# :)
alias PINK='beep -f 233 -l 440 -n -f 349 -l 440 -n -f 196 -l 440 -n -f 330 -l 650'

View File

@ -1,12 +0,0 @@
_workon() {
local cur prev envs
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
envs=$(ls /opt/pythonenv/)
COMPREPLY=( $(compgen -W "${envs}" -- ${cur}) )
}
complete -F _workon workon

View File

@ -1,96 +0,0 @@
parse_git_branch() {
if ! [ -x "$(command -v git)" ]; then
return
fi
local branch status
# current branch
branch="$(git branch --show-current 2> /dev/null)"
# current status
# M = modified
# A = added
# D = deleted
# R = renamed
# C = copied
# U = updated but unmerged
status="$(git status -s 2>/dev/null | cut -c 1 | sort -u | tr -d " \n?")"
if [ -n "$status" ]; then
status="-[$status]"
fi
if [[ -n "$branch" ]]; then
echo "($branch)$status"
fi
}
virtualenv_info() {
# Get Virtual Env
if [[ -n "$VIRTUAL_ENV" ]]; then
# Strip out the path and just leave the env name
echo "($(basename "$VIRTUAL_ENV"))"
fi
}
rightprompt()
{
if [[ $1 -ne 0 ]]; then
printf "%*s" $COLUMNS "$1 "
fi
}
export PROMPT_COMMAND=__prompt_command
__prompt_command() {
local EXIT=${PIPESTATUS[-1]}
close_color='\[\e[m\]'
red_color='\[\033[1;31m\]'
prompt_color='\[\033[;32m\]'
info_color='\[\033[1;34m\]'
prompt_symbol='@'
end_symbol='$'
if [ "$EUID" -eq 0 ]; then # Change prompt colors and symbols for root user
prompt_color='\[\033[;94m\]'
info_color='\[\033[1;31m\]'
end_symbol='#'
fi
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
prompt_symbol='📡'
fi
export VIRTUAL_ENV_DISABLE_PROMPT=1
local VENV_ BRANCH_ TERMINAL_NAME
VENV_="\$(virtualenv_info)"
BRANCH_="\$(parse_git_branch)"
TERMINAL_NAME=${0%%/*}
TERMINAL_NAME="\[\e]2;${TERMINAL_NAME^^}\a\]"
_bottom_prompt="$(tput cup 999 0)"
if [ "$EXIT" != 0 ]; then
PS1="$TERMINAL_NAME${_bottom_prompt}\n$prompt_color┌─${VENV_}─($close_color$info_color\u$prompt_symbol\H$close_color$prompt_color)-[$close_color\w$prompt_color]$close_color $red_color${BRANCH_}$close_color\n\[$(tput sc; rightprompt $EXIT; tput rc)\]$prompt_color└─$close_color$info_color$end_symbol$close_color "
else
PS1="$TERMINAL_NAME${_bottom_prompt}\n$prompt_color┌─${VENV_}─($close_color$info_color\u$prompt_symbol\H$close_color$prompt_color)-[$close_color\w$prompt_color]$close_color $red_color${BRANCH_}$close_color\n$prompt_color└─$close_color$info_color$end_symbol$close_color "
fi
PS2="> "
}

View File

@ -1,12 +0,0 @@
## Misc
shopt -s histappend ## Appends hist on exit
shopt -s cmdhist ## Save multi-line hist as one line
shopt -s checkwinsize ## Update col/lines after commands
### Completion
shopt -s cdspell ## Fixes minor spelling errors in cd paths
shopt -s no_empty_cmd_completion ## Stops empty line tab comp
shopt -s dirspell 2>/dev/null ## Tab comp can fix dir name typos
bind '"\e."':yank-last-arg

View File

@ -1,19 +0,0 @@
_so() {
[ -r "$1" ] && [ -f "$1" ] && source "$1"
}
if [[ $0 == *bash ]]; then
_so "$HOME/.config/bash/export"
_so "$HOME/.config/bash/shopt"
fi
if [[ $- == *i* ]]; then
_so "$HOME/.config/bash/prompt"
_so "$HOME/.config/bash/aliases"
_so "$HOME/.config/bash/functions"
_so "$HOME/.config/bash/completion"
_so "$HOME/.config/bash/hosts/$HOSTNAME"
fi
_sod "$HOME/.config/bash/bashrc.d"

View File

@ -1,5 +1,145 @@
# vim: ft=zsh # vim: ft=zsh
_d() { true ; }
_f() { true ; }
# colors
if [ -x "$(command -v dircolors)" ]; then
export LS_OPTIONS="--color=auto"
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias grep='grep $LS_OPTIONS'
alias fgrep='fgrep $LS_OPTIONS'
alias ls='ls -v $LS_OPTIONS'
fi
alias l.='ls -AFv --ignore="*"'
alias ll='ls -lhFv'
alias la='ls -AFv'
alias lla='ls -lhFAv'
alias ll.='ls -lhFAv --ignore="*"'
alias lsl='_d() { ls -lhFA --color=always "${1:-.}" | $PAGER ; }; _d'
alias _='sudo'
alias root='sudo -i TMOUT=450'
alias rm='rm -Ivr --one-file-system'
alias mkdir='mkdir -pv'
alias cl='_d() { cd "${1:-$HOME}" && ls; }; _d'
alias q='exit 0'
alias wp='cd "$WORKING_PROJECT"'
alias path='echo -e ${PATH//:/\\n}'
alias dh='dirs -v'
alias pd='popd'
# shorts
alias c='clear'
alias h='history 0'
alias j='jobs -l'
# utils
alias sha='(shasum -a 256 | head -c 64)'
alias genpass="openssl rand -base64 12"
alias gensalt="dd if=/dev/urandom count=16 2>/dev/null | sha256sum | head -c 64"
alias diff='colordiff'
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man'
# time
alias now='date +"%T"'
alias nowdate='date +"%d-%m-%Y"'
alias cal='cal -m'
alias beeptime='beep -D 400 -l 400 -r "$(date +%I)" -f 440 -n -D 1000 -l 0 -n -D 800 -l 200 -f 880 -r "$(($(date +%M)/15))"'
# vim
alias vi='nvim'
alias svi="sudo -E nvim"
# net
alias ports='ss -tlnp'
alias wget='wget -c'
# alias myip='curl ipinfo.io/ip'
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
alias sprunge='curl -F "sprunge=<-" http://sprunge.us 2>/dev/null' # CLI pastebin
alias weather='(curl -4 wttr.in/$(cat) 2>/dev/null | head -n -1) <<<'
alias ip='ip -c'
alias fastping='ping -c 100 -i 0.1'
# starts web server
alias www='python3 -m http.server 8080'
# hardware
alias reboot='sudo /sbin/reboot'
alias poweroff='sudo /sbin/poweroff'
alias suspend='sudo systemctl suspend'
alias halt='sudo /sbin/halt'
alias shutdown='sudo /sbin/shutdown now'
alias meminfo='free -mlth'
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
alias wake='((speaker-test -t sine -f 400 &>/dev/null)& local pid=$! ;sleep 0.2s; kill -9 $pid) &>/dev/null'
elif [[ "$OSTYPE" == "linux-android"* ]]; then
alias wake='termux-notification --sound --vibrate 500,1000,200'
fi
# python
alias pipir='pip install -r requirements.txt'
alias pipar='pip list --not-required --format freeze | tee requirements.txt'
alias vd='deactivate'
# git
alias watch-diff='watch --color "git diff --color=always"'
# docker
alias dcu='docker-compose up -d'
alias dcd='docker-compose down'
alias drmc='docker container prune'
alias drmi='docker image prune'
# tmux
alias dt='tmux detach'
# x11
alias caps='xdotool key Caps_Lock'
alias CAPS='xdotool key Caps_Lock'
alias colors='for i in {0..255}; do printf "\x1b[38;5;${i}mcolor${i} - ██████████\n"; done'
# clipboard
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ -n "$DISPLAY" ]]; then
alias copy='xclip -selection clipboard -i'
alias paste='xclip -selection clipboard -o'
else
alias copy='read -rd "EOF" TTYCLIPBOARD'
alias paste='echo "$TTYCLIPBOARD"'
fi
elif [[ "$OSTYPE" == "linux-android"* ]]; then
alias copy='termux-clipboard-set'
alias paste='termux-clipboard-get'
elif [[ "$OSTYPE" == "darwin" ]]; then
alias copy='pbcopy'
alias paste='pbpaste'
fi
alias sshn='ssh -S none'
alias black='magick canvas:none PNG:- | feh -YF -'
# :)
alias PINK='beep -f 233 -l 440 -n -f 349 -l 440 -n -f 196 -l 440 -n -f 330 -l 650'
alias -g L='| $PAGER' alias -g L='| $PAGER'
alias -g H='| head' alias -g H='| head'
alias -g T='| tail' alias -g T='| tail'

View File

@ -1,4 +1,4 @@
# vim: ft=bash # vim: ft=zsh
umask 022 umask 022

View File

@ -1,4 +1,4 @@
# vim: ft=bash # vim: ft=zsh
_sod() { _sod() {
if [ -d "$1" ] && [ -n "$(ls "$1")" ]; then if [ -d "$1" ] && [ -n "$(ls "$1")" ]; then

View File

@ -1,27 +1,26 @@
# vim: ft=zsh # vim: ft=zsh
_so() { _so() {
[ -r "$1" ] && [ -f "$1" ] && source "$1" [ -r "${1}" ] && [ -f "${1}" ] && source "${1}"
} }
_so "$XDG_CONFIG_HOME/bash/export"
_so "$XDG_CONFIG_HOME/bash/aliases"
_so "$XDG_CONFIG_HOME/bash/functions"
_so "$XDG_CONFIG_HOME/bash/hosts/$HOST"
_so "${ZDOTDIR}/export"
_so "${ZDOTDIR}/hosts/${HOST}"
_so "$ZDOTDIR/options" _so "${ZDOTDIR}/options"
_so "$ZDOTDIR/completion" _so "${ZDOTDIR}/completion"
_so "$ZDOTDIR/history" _so "${ZDOTDIR}/history"
_so "$ZDOTDIR/prompt" _so "${ZDOTDIR}/prompt"
_so "$ZDOTDIR/other" _so "${ZDOTDIR}/other"
_so "$ZDOTDIR/aliases" _so "${ZDOTDIR}/aliases"
_so "${ZDOTDIR}/functions"
_so "$ZDOTDIR/plugin" _so "${ZDOTDIR}/plugin"
_so "$ZDOTDIR/mappings" _so "${ZDOTDIR}/mappings"
_so "$ZDOTDIR/calculator" _so "${ZDOTDIR}/calculator"
_sod "$ZDOTDIR/zshrc.d" _sod "${ZDOTDIR}/zshrc.d"

View File

@ -1,5 +0,0 @@
if [ -n "$BASH_VERSION" ]; then
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

View File

@ -1,5 +1,5 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
for zfile in .zshenv .config/zsh/.zshrc .config/zsh/.zprofile .config/zsh/.zlogout .config/zsh/aliases .config/zsh/completion .config/zsh/history .config/zsh/options .config/zsh/other .config/zsh/plugin .config/zsh/calculator .config/zsh/prompt .config/zsh/mappings .config/zsh/sourcer; do for zfile in .zshenv .config/zsh/.zshrc .config/zsh/.zprofile .config/zsh/.zlogout .config/zsh/aliases .config/zsh/completion .config/zsh/history .config/zsh/options .config/zsh/other .config/zsh/plugin .config/zsh/calculator .config/zsh/prompt .config/zsh/mappings .config/zsh/sourcer .config/zsh/export .config/zsh/functions; do
zcompile "$HOME/$zfile" zcompile "$HOME/$zfile"
done done