From 7f66492f2a10adababdc65118ae69a77ee8d3b7d Mon Sep 17 00:00:00 2001 From: thek4n Date: Sat, 2 Nov 2024 12:53:43 +0300 Subject: [PATCH] remove bash --- TARGETS.sh | 3 +- etc/skel/.bash_profile | 5 - etc/skel/.bashrc | 26 ---- home/user/.bashrc | 23 --- home/user/.config/bash/aliases | 140 ------------------ home/user/.config/bash/completion | 12 -- home/user/.config/bash/hosts/.gitkeep | 0 home/user/.config/bash/prompt | 96 ------------ home/user/.config/bash/shopt | 12 -- home/user/.config/bash/sourcer | 19 --- home/user/.config/zsh/aliases | 140 ++++++++++++++++++ home/user/.config/{bash => zsh}/export | 2 +- home/user/.config/{bash => zsh}/functions | 2 +- .../{bash/bashrc.d => zsh/hosts}/.gitkeep | 0 home/user/.config/zsh/sourcer | 29 ++-- home/user/.profile | 5 - install-hooks/zsh/post-install | 2 +- 17 files changed, 158 insertions(+), 358 deletions(-) delete mode 100644 etc/skel/.bash_profile delete mode 100644 etc/skel/.bashrc delete mode 100644 home/user/.bashrc delete mode 100644 home/user/.config/bash/aliases delete mode 100644 home/user/.config/bash/completion delete mode 100644 home/user/.config/bash/hosts/.gitkeep delete mode 100644 home/user/.config/bash/prompt delete mode 100644 home/user/.config/bash/shopt delete mode 100644 home/user/.config/bash/sourcer rename home/user/.config/{bash => zsh}/export (98%) rename home/user/.config/{bash => zsh}/functions (99%) rename home/user/.config/{bash/bashrc.d => zsh/hosts}/.gitkeep (100%) delete mode 100644 home/user/.profile diff --git a/TARGETS.sh b/TARGETS.sh index 78f2b1c..c6ab009 100644 --- a/TARGETS.sh +++ b/TARGETS.sh @@ -1,8 +1,7 @@ declare -r -A TARGETS=( ["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" - ["bash"]=".config/bash .bashrc .profile %tmux %colors" - ["zsh"]="%bash .config/zsh .zshenv .inputrc" + ["zsh"]=".config/zsh .zshenv .inputrc %colors" ["alacritty"]=".config/alacritty" ["nvim"]=".config/nvim .editorconfig .inputrc .editrc .local/bin/vim_askpass_helper" ["ssh"]="" diff --git a/etc/skel/.bash_profile b/etc/skel/.bash_profile deleted file mode 100644 index 5545f00..0000000 --- a/etc/skel/.bash_profile +++ /dev/null @@ -1,5 +0,0 @@ -# -# ~/.bash_profile -# - -[[ -f ~/.bashrc ]] && . ~/.bashrc diff --git a/etc/skel/.bashrc b/etc/skel/.bashrc deleted file mode 100644 index d9c98e0..0000000 --- a/etc/skel/.bashrc +++ /dev/null @@ -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└─\$ " \ No newline at end of file diff --git a/home/user/.bashrc b/home/user/.bashrc deleted file mode 100644 index 18f65ce..0000000 --- a/home/user/.bashrc +++ /dev/null @@ -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 \ No newline at end of file diff --git a/home/user/.config/bash/aliases b/home/user/.config/bash/aliases deleted file mode 100644 index 7e30e0b..0000000 --- a/home/user/.config/bash/aliases +++ /dev/null @@ -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' \ No newline at end of file diff --git a/home/user/.config/bash/completion b/home/user/.config/bash/completion deleted file mode 100644 index a139eee..0000000 --- a/home/user/.config/bash/completion +++ /dev/null @@ -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 - diff --git a/home/user/.config/bash/hosts/.gitkeep b/home/user/.config/bash/hosts/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/home/user/.config/bash/prompt b/home/user/.config/bash/prompt deleted file mode 100644 index 08acec4..0000000 --- a/home/user/.config/bash/prompt +++ /dev/null @@ -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="> " -} \ No newline at end of file diff --git a/home/user/.config/bash/shopt b/home/user/.config/bash/shopt deleted file mode 100644 index 1d95db3..0000000 --- a/home/user/.config/bash/shopt +++ /dev/null @@ -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 diff --git a/home/user/.config/bash/sourcer b/home/user/.config/bash/sourcer deleted file mode 100644 index 8d385cb..0000000 --- a/home/user/.config/bash/sourcer +++ /dev/null @@ -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" diff --git a/home/user/.config/zsh/aliases b/home/user/.config/zsh/aliases index 8d031b4..28a0560 100644 --- a/home/user/.config/zsh/aliases +++ b/home/user/.config/zsh/aliases @@ -1,5 +1,145 @@ # 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 H='| head' alias -g T='| tail' diff --git a/home/user/.config/bash/export b/home/user/.config/zsh/export similarity index 98% rename from home/user/.config/bash/export rename to home/user/.config/zsh/export index 511ddee..16bf10b 100644 --- a/home/user/.config/bash/export +++ b/home/user/.config/zsh/export @@ -1,4 +1,4 @@ -# vim: ft=bash +# vim: ft=zsh umask 022 diff --git a/home/user/.config/bash/functions b/home/user/.config/zsh/functions similarity index 99% rename from home/user/.config/bash/functions rename to home/user/.config/zsh/functions index 00824b0..963fc85 100644 --- a/home/user/.config/bash/functions +++ b/home/user/.config/zsh/functions @@ -1,4 +1,4 @@ -# vim: ft=bash +# vim: ft=zsh _sod() { if [ -d "$1" ] && [ -n "$(ls "$1")" ]; then diff --git a/home/user/.config/bash/bashrc.d/.gitkeep b/home/user/.config/zsh/hosts/.gitkeep similarity index 100% rename from home/user/.config/bash/bashrc.d/.gitkeep rename to home/user/.config/zsh/hosts/.gitkeep diff --git a/home/user/.config/zsh/sourcer b/home/user/.config/zsh/sourcer index 524aa63..c944675 100644 --- a/home/user/.config/zsh/sourcer +++ b/home/user/.config/zsh/sourcer @@ -1,27 +1,26 @@ # vim: ft=zsh _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/completion" -_so "$ZDOTDIR/history" -_so "$ZDOTDIR/prompt" -_so "$ZDOTDIR/other" -_so "$ZDOTDIR/aliases" +_so "${ZDOTDIR}/options" +_so "${ZDOTDIR}/completion" +_so "${ZDOTDIR}/history" +_so "${ZDOTDIR}/prompt" +_so "${ZDOTDIR}/other" +_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" \ No newline at end of file +_sod "${ZDOTDIR}/zshrc.d" \ No newline at end of file diff --git a/home/user/.profile b/home/user/.profile deleted file mode 100644 index 44204ce..0000000 --- a/home/user/.profile +++ /dev/null @@ -1,5 +0,0 @@ -if [ -n "$BASH_VERSION" ]; then - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi -fi diff --git a/install-hooks/zsh/post-install b/install-hooks/zsh/post-install index d785db9..0ba72c4 100755 --- a/install-hooks/zsh/post-install +++ b/install-hooks/zsh/post-install @@ -1,5 +1,5 @@ #!/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" done \ No newline at end of file