#+TITLE: My Shells Configs #+AUTHOR: Naz #+STARTUP: showeverything #+OPTIONS: toc:nil #+PROPERTY: header-args :mkdirp yes #+auto_tangle: t * Table Of Content :toc: - [[#aliases][Aliases]] - [[#basic][Basic]] - [[#package-managers][Package Managers]] - [[#youtube][YouTube]] - [[#use-doas][Use doas]] - [[#all-aliases][All Aliases]] - [[#functions][Functions]] - [[#lf-navigation][LF Navigation]] - [[#make--cd-to-directory][Make & CD to Directory]] - [[#all-functions][All Functions]] - [[#prompt][Prompt]] - [[#zsh][ZSH]] - [[#bash][Bash]] - [[#configuration][Configuration]] - [[#history-settings][History Settings]] - [[#shell-specific][Shell Specific]] - [[#shell-rc-files][Shell RC Files]] * Aliases This is a collection of aliases to make the shell usable, for those who can't type 99999 WPM. #+NAME: source-aliases #+begin_src sh source $HOME/.config/shells/aliases #+end_src ** Basic Starting off with some colors! Some of these aliases depend on some Rust /based/ CLIs (~zoxide~, ~eza~). #+NAME: basic-aliases #+begin_src sh alias cp='cp -iv' alias mv='mv -iv' alias rm='rm -vI' alias cd='z' alias ls='eza --icons=always --group-directories-first' alias ll='ls -la --git' alias dir='ll ./*' alias tree='ls -Ta -I ".git|target"' alias cls='clear' alias v='nvim' alias rv='command sudo -E nvim' alias code='codium' alias dl='wget -cq --show-progress' alias ip='ip -c' alias ping='ping -c 3' alias py='python' #+end_src ** Package Managers *** XBPS No need for any of these, just use [[https://git.ch-naseem.com/noid-linux/ndpm][ndpm]] instead. #+NAME: xbps-aliases #+begin_src sh alias xi='doas xbps-install -S' alias xq='doas xbps-query -Rs' alias xr='doas xbps-remove -R' alias xo='xr -Oo' alias xu='xi && doas xbps-install -uy xbps && doas xbps-install -uy && xo && pkill -RTMIN+14 dwmblocks' alias xf="xq '' | cut -d' ' -f2 | fzf --multi --preview 'xbps-query -R {1}' --preview-window=down:75% | xargs -ro xi" #+end_src *** Cargo The name of the package is ~cargo-update~, you are welcome. #+NAME: cargo-aliases #+begin_src sh alias cargo-update='cargo install-update -a' #+end_src *** Python 💩 #+NAME: pip-aliases #+begin_src sh alias pip-update='pip install --upgrade pip' #+end_src ** YouTube For these you'll need ~mpv~ obviously but also ~yt-dlp~. YouTube is bloated AF and Invidious is getting canceled, so get advantage of these and consume your brainrot in peace. #+NAME: youtube-aliases #+begin_src sh alias yt480="mpv --save-position-on-quit '--ytdl-format=bv*[height<=480]+ba'" alias yt720="mpv --save-position-on-quit '--ytdl-format=bv*[height<=720]+ba'" alias yt1080="mpv --save-position-on-quit '--ytdl-format=bv*[height<=1080]+ba'" #+end_src ** Use doas YOU SHOULD NOT USE SUDO BECAUSE IT'S BLOATED AND DOESN'T FOLLOW UNIX PHILOSOPHY THUS IT'S EVIL AND INVADES YOUR PRIVACY AND USED BY BIG TECH TO BRAIN WASH YOUR BRAIN!!! #+NAME: sudo-alias #+begin_src sh alias sudo='echo "use doas idiot" ||' #+end_src ** All Aliases #+NAME: all-aliases #+begin_src sh :tangle .config/shells/aliases :noweb yes # Basic Aliases <> # XBPS Aliases <> # Cargo Aliases <> # Python Aliases <> # YouTube Aliases <> # Use doas <> #+end_src * Functions I'll probably convert these into small shell scripts and remove this block, for now tho they're staying here. #+NAME: source-functions #+begin_src sh source $HOME/.config/shells/functions #+end_src ** LF Navigation No idea what this is for, I copied it from [[https://github.com/gokcehan/lf/blob/master/etc/lfcd.sh][here]]. #+NAME: lf-functions #+begin_src sh LFCD="$HOME/.local/bin/lfcd" if [ -f "$LFCD" ]; then source "$LFCD" fi #+end_src ** Make & CD to Directory ...need I say more? #+NAME: md-function #+begin_src sh function md { mkdir -pv "$1" && cd "$1"; } #+end_src ** All Functions #+NAME: all-functions #+begin_src sh :tangle .config/shells/functions :noweb yes # LF Functions <> # MD Function <> #+end_src * Prompt A great person once said: #+begin_quote A beautiful prompt improves the productivity and efficiency of developers. The more colors and nerd icons you add the greater your productivity gets. #+end_quote ** ZSH *** Simple #+NAME: zsh-simple-prompt #+begin_src sh PROMPT=" %F{7}%~%f %B$ " #+end_src *** Starship #+NAME: zsh-starship-prompt #+begin_src sh eval "$(starship init zsh)" #+end_src *** Oh My Posh #+NAME: zsh-omp-prompt #+begin_src sh eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/config.toml)" #+end_src ** Bash *** Simple #+NAME: bash-simple-prompt #+begin_src sh PS1='\[\e[91;1m\][\[\e[93m\]\u\[\e[92m\]@\[\e[94m\]\h \[\e[0;95m\]\W\[\e[91;1m\]]\[\e[0m\]\\$ ' #+end_src *** Starship #+NAME: bash-starship-prompt #+begin_src sh eval "$(starship init bash)" #+end_src * Configuration ** History Settings #+NAME: config-history #+begin_src sh HISTFILE=$HOME/.config/shells/history HISTSIZE=50000 SAVEHIST=50000 #+end_src ** Shell Specific *** ZSH **** Syntax highlighting For this you'll need to install a package named ~zsh-syntax-highlighting~ in the xbps repositories, look it up if you are not a Void user. #+NAME: zsh-syntax-highlighting #+begin_src zsh source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh #+end_src **** Colors settings #+NAME: zsh-colors #+begin_src zsh autoload -U colors && colors #+end_src **** Completion As before the package's name in the xbps repos is ~zsh-completions~. #+NAME: zsh-completion #+begin_src zsh autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit _comp_options+=(globdots) #+end_src Use vi bindings in tab complete menu. #+NAME: zsh-completion-vi #+begin_src zsh bindkey -M menuselect 'h' vi-backward-char bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history bindkey -v '^?' backward-delete-char #+end_src **** Vi mode #+NAME: zsh-vi #+begin_src zsh bindkey -v #+end_src **** Key bindings #+NAME: zsh-key-bindings #+begin_src zsh bindkey -s '^o' 'lf\n' bindkey -s '^v' 'v\n' #+end_src **** Fix cursor When using the underscore ~_~ character as the terminal's cursor, Neovim might override it with the ugly block cursor. Using this mess down here you can stop that. #+NAME: zsh-nvim-cursor #+begin_src zsh zle-line-init() { echo -e -n "\x1b[\x34 q" } zle -N zle-line-init echo -e -n "\x1b[\x34 q" preexec() { echo -e -n "\x1b[\x34 q" ;} #+end_src **** Evals ***** Zoxide #+NAME: zsh-eval-zoxide #+begin_src zsh eval "$(zoxide init zsh)" #+end_src ***** Fzf #+NAME: zsh-eval-fzf #+begin_src zsh source <(fzf --zsh) #+end_src *** bash **** Completion Just like with ZSH completions you'll need to install a package named ~bash-completion~ in the xbps repos. #+NAME: bash-completion #+begin_src bash [[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ . /usr/share/bash-completion/bash_completion #+end_src **** Vi mode #+NAME: bash-vi #+begin_src bash set -o vi #+end_src **** Evals ***** Zoxide #+NAME: bash-eval-zoxide #+begin_src bash eval "$(zoxide init bash)" #+end_src ***** Fzf #+NAME: bash-eval-fzf #+begin_src bash eval "$(fzf --bash)" #+end_src ** Shell RC Files *** Common #+NAME: source-shellsrc #+begin_src sh source $HOME/.config/shells/shellsrc #+end_src **** SHELLSRC #+NAME: shellsrc #+begin_src sh :tangle .config/shells/shellsrc :noweb yes # History settings <> # Aliases <> # Functions <> #+end_src *** ZSH #+NAME: dotzshrc #+begin_src zsh :tangle .zshrc source $HOME/.config/zsh/zshrc #+end_src **** ZSHRC #+NAME: zshrc #+begin_src zsh :tangle .config/zsh/zshrc :noweb yes # Common configs <> # Syntax highlighting <> # Colors settings <> # Completion <> <> # Vi mode <> # Key bindings <> # Fix Cursor Shape After Using Neovim <> # Eval Zoxide <> # Eval FZF <> # Prompt <> #+end_src *** Bash #+NAME: dotbashrc #+begin_src bash :tangle .bashrc source $HOME/.config/bash/bashrc #+end_src **** BASHRC #+NAME: bashrc #+begin_src bash :tangle .config/bash/bashrc :noweb yes # Common configs <> # Completion <> # Vi mode <> # Eval Zoxide <> # Eval FZF <> # Prompt <> #+end_src