From e5ab1547c3c6d741f79b21a0c2bf6dc460e18141 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Sun, 16 May 2021 18:20:01 -0400 Subject: [PATCH] Switch from Zsh to ash There might be a website page about this soon --- config.org | 163 +++++++++++++++-------------------------------------- 1 file changed, 44 insertions(+), 119 deletions(-) diff --git a/config.org b/config.org index 7f9aa05..a903a93 100644 --- a/config.org +++ b/config.org @@ -261,7 +261,7 @@ Add back C-a/C-x ;; TODO: There's gotta be a more efficient way to write this (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf")) - (add-to-list 'org-structure-template-alist '("zsh" . "src shell :tangle ~/.config/zsh/zshrc")) + (add-to-list 'org-structure-template-alist '("ash" . "src shell :tangle ~/.config/ash/ashrc")) (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml")) (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/")) (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf")) @@ -746,66 +746,14 @@ No more clogging up init.el. quirk[Castle Menu] = FLOAT quirk[momen] = FLOAT #+end_src -** Zsh -*** Settings -**** Completions -#+begin_src shell :tangle ~/.config/zsh/zshrc - autoload -Uz compinit - compinit - - setopt no_case_glob - unsetopt glob_complete -#+end_src -**** Vim bindings -#+begin_src shell :tangle ~/.config/zsh/zshrc - bindkey -v - KEYTIMEOUT=1 - - bindkey -M vicmd "^[[3~" delete-char - bindkey "^[[3~" delete-char - - autoload edit-command-line - zle -N edit-command-line - bindkey -M vicmd ^e edit-command-line - bindkey ^e edit-command-line -#+end_src -**** History -#+begin_src shell :tangle ~/.config/zsh/zshrc - setopt extended_history - setopt share_history - setopt inc_append_history - setopt hist_ignore_dups - setopt hist_reduce_blanks - - HISTSIZE=100000 - SAVEHIST=100000 - HISTFILE=~/.local/share/zsh/history -#+end_src -*** Plugins -I manage plugins using my own plugin manager, ZPE. https://git.sr.ht/~armaan/zpe - -Right now, I'm only using fast-syntax-highlighting. It's a really nice visual addition. -**** ZPE -#+begin_src conf :tangle ~/.config/zpe/repositories - https://github.com/zdharma/fast-syntax-highlighting -#+end_src -**** Zshrc -#+begin_src shell :tangle ~/.config/zsh/zshrc - source ~/Code/zpe/zpe.sh - source ~/Code/admone/admone.zsh - source ~/.config/zsh/fzf-bindings.zsh - - zpe-source fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh +** Ash +*** Options +#+begin_src conf :tangle ~/.config/ash/ashrc + set -o vi #+end_src *** Functions -**** Time Zsh startup -#+begin_src shell :tangle ~/.config/zsh/zshrc - timer() { - for i in $(seq 1 10); do time "$1" -i -c exit; done - } -#+end_src **** Update all packages -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc color=$(tput setaf 5) reset=$(tput sgr0) @@ -830,7 +778,7 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad } #+end_src **** Clean all packages -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc apap() { sudo echo "${color}== cleaning pacman orphans ==${reset}" (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans" @@ -848,33 +796,17 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad echo "${color}All orphans cleaned!${reset}" } #+end_src -**** Setup anaconda -#+begin_src shell :tangle ~/.config/zsh/zshrc - zconda() { - __conda_setup="$('/opt/anaconda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" - if [ $? -eq 0 ]; then - eval "$__conda_setup" - else - if [ -f "/opt/anaconda/etc/profile.d/conda.sh" ]; then - . "/opt/anaconda/etc/profile.d/conda.sh" - else - export PATH="/opt/anaconda/bin:$PATH" - fi - fi - unset __conda_setup - } -#+end_src **** Interact with 0x0 -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc zxz="https://envs.sh" - 0file() { curl -F"file=@$1" "$zxz" ; } - 0pb() { curl -F"file=@-;" "$zxz" ; } - 0url() { curl -F"url=$1" "$zxz" ; } - 0short() { curl -F"shorten=$1" "$zxz" ; } - 0clip() { xclip -out | curl -F"file=@-;" "$zxz" ; } + ufile() { curl -F"file=@$1" "$zxz" ; } + upb() { curl -F"file=@-;" "$zxz" ; } + uurl() { curl -F"url=$1" "$zxz" ; } + ushort() { curl -F"shorten=$1" "$zxz" ; } + uclip() { xclip -out | curl -F"file=@-;" "$zxz" ; } #+end_src **** Finger -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc finger() { user=$(echo "$1" | cut -f 1 -d '@') host=$(echo "$1" | cut -f 2 -d '@') @@ -882,7 +814,7 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad } #+end_src **** Upload to ftp.armaanb.net -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc pubup() { rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}" echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c @@ -890,28 +822,26 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad #+end_src *** Aliases **** SSH -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias bhoji-drop='ssh -p 23 root@armaanb.net' - alias catgirl='ssh root@armaanb.net -t abduco -A irc catgirl freenode' + alias irc='ssh root@armaanb.net -t abduco -A irc catgirl freenode' alias union='ssh 192.168.1.18' alias mine='ssh -p 23 root@pickupserver.cc' alias tcf='ssh root@204.48.23.68' alias ngmun='ssh root@157.245.89.25' alias prox='ssh root@192.168.1.224' alias ncq='ssh root@143.198.123.17' - alias dock='ssh root@192.168.1.225' - alias jenkins='ssh root@192.168.1.226' alias envs='ssh acheam@envs.net' #+end_src **** File management -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias ls='exa -lh --icons --git --group-directories-first' alias la='exa -lha --icons --git --group-directories-first' alias df='df -h / /boot' alias du='du -h' alias free='free -h' alias cp='cp -riv' - alias rm='rm -Iv' + alias rm='rm -iv' alias mv='mv -iv' alias ln='ln -iv' alias grep='grep -in --exclude-dir=.git --color=auto' @@ -920,15 +850,10 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad alias unar='atool -x' alias wget='wget -e robots=off' alias lanex='~/.local/share/lxc/lxc' -#+end_src -**** Editing -#+begin_src shell :tangle ~/.config/zsh/zshrc - alias v='nvim' alias vim='nvim' - alias vw="nvim ~/Documents/vimwiki/index.md" #+end_src **** System management -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias jctl='journalctl -p 3 -xb' alias pkill='pkill -i' alias cx='chmod +x' @@ -940,25 +865,25 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad yadm push' #+end_src **** Networking -#+begin_src shell :tangle ~/.config/zsh/zshrc - alias ping='ping -c 10' - alias speed='speedtest-cli' - alias ip='ip --color=auto' - alias cip='curl https://armaanb.net/ip' - alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys' - alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key' - alias plan='T=$(mktemp) && \ - rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \ - TT=$(mktemp) && \ - head -n -2 $T > $TT && \ - vim $TT && \ - echo "\nLast updated: $(date -R)" >> "$TT" && \ - fold -sw 72 "$TT" > "$T"| \ - rsync "$T" root@armaanb.net:/etc/finger/plan.txt' - alias wttr='curl -s "wttr.in/02445?n" | head -n -3' +#+begin_src shell :tangle ~/.config/ash/ashrc + alias ping='ping -c 10' + alias speed='speedtest-cli' + alias ip='ip --color=auto' + alias cip='curl https://armaanb.net/ip' + alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys' + alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key' + alias plan='T=$(mktemp) && \ + rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \ + TT=$(mktemp) && \ + head -n -2 $T > $TT && \ + vim $TT && \ + echo "\nLast updated: $(date -R)" >> "$TT" && \ + fold -sw 72 "$TT" > "$T"| \ + rsync "$T" root@armaanb.net:/etc/finger/plan.txt' + alias wttr='curl -s "wttr.in/02445?n" | head -n -3' #+end_src **** Other -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \ iflag=fullblock status=progress' alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \ @@ -974,7 +899,7 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad alias bc='bc -l' #+end_src **** Virtual machines, chroots -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias ckiss="sudo chrooter ~/Virtual/kiss" alias cdebian="sudo chrooter ~/Virtual/debian bash" alias cwindows='devour qemu-system-x86_64 \ @@ -990,7 +915,7 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2' #+end_src **** Python -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias ipy="ipython" alias zpy="zconda && ipython" alias math="ipython --profile=math" @@ -999,12 +924,12 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad alias black="black -l 79" #+end_src **** Latin -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias words='gen-shell -c "words"' alias words-e='gen-shell -c "words ~E"' #+end_src **** Devour -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias zathura='devour zathura' alias mpv='devour mpv' alias sql='devour sqlitebrowser' @@ -1012,7 +937,7 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad alias feh='devour feh' #+end_src **** Package management (Pacman) -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias aps='yay -Ss' alias api='yay -Syu' alias apii='sudo pacman -S' @@ -1026,12 +951,12 @@ Right now, I'm only using fast-syntax-highlighting. It's a really nice visual ad ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run #+end_src **** Package management (KISS) -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc alias kzf="kiss s \* | xargs -l basename | \ fzf --preview 'kiss search {} | xargs -l dirname'" #+end_src *** Exports -#+begin_src shell :tangle ~/.config/zsh/zshrc +#+begin_src shell :tangle ~/.config/ash/ashrc export EDITOR="emacsclient -c" export VISUAL="$EDITOR" export TERM=xterm-256color # for compatability -- 2.39.2