diff options
| author | Naz <ndpm13@ch-naseem.com> | 2025-09-05 22:39:18 +0100 |
|---|---|---|
| committer | Naz <ndpm13@ch-naseem.com> | 2025-09-06 12:17:49 +0100 |
| commit | 8f0048fde624e304203552d5ebef92ca6f30d618 (patch) | |
| tree | 63464a134451f314dedc21712157af70611138b6 | |
✨feat: add shells configuration files.
| -rw-r--r-- | shells/.bash_profile | 2 | ||||
| -rw-r--r-- | shells/.bashrc | 1 | ||||
| -rw-r--r-- | shells/.config/bash/bashrc | 18 | ||||
| -rw-r--r-- | shells/.config/shells/aliases | 39 | ||||
| -rw-r--r-- | shells/.config/shells/functions | 8 | ||||
| -rw-r--r-- | shells/.config/shells/shellsrc | 10 | ||||
| -rw-r--r-- | shells/.config/zsh/zshrc | 45 | ||||
| -rw-r--r-- | shells/.zprofile | 2 | ||||
| -rw-r--r-- | shells/.zshrc | 1 | ||||
| -rw-r--r-- | shells/README.org | 467 |
10 files changed, 593 insertions, 0 deletions
diff --git a/shells/.bash_profile b/shells/.bash_profile new file mode 100644 index 0000000..48100df --- /dev/null +++ b/shells/.bash_profile @@ -0,0 +1,2 @@ +# Fix GPG TTY Error +export GPG_TTY=$(tty) diff --git a/shells/.bashrc b/shells/.bashrc new file mode 100644 index 0000000..ba92f67 --- /dev/null +++ b/shells/.bashrc @@ -0,0 +1 @@ +source $HOME/.config/bash/bashrc diff --git a/shells/.config/bash/bashrc b/shells/.config/bash/bashrc new file mode 100644 index 0000000..a38ac14 --- /dev/null +++ b/shells/.config/bash/bashrc @@ -0,0 +1,18 @@ +# Common configs +source $HOME/.config/shells/shellsrc + +# Completion +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion + +# Vi mode +set -o vi + +# Eval Zoxide +eval "$(zoxide init bash)" + +# Eval FZF +eval "$(fzf --bash)" + +# Prompt +PS1='\[\e[91;1m\][\[\e[93m\]\u\[\e[92m\]@\[\e[94m\]\h \[\e[0;95m\]\W\[\e[91;1m\]]\[\e[0m\]\\$ ' diff --git a/shells/.config/shells/aliases b/shells/.config/shells/aliases new file mode 100644 index 0000000..10b26b7 --- /dev/null +++ b/shells/.config/shells/aliases @@ -0,0 +1,39 @@ +# Basic Aliases +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' + +# XBPS Aliases +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" + +# Cargo Aliases +alias cargo-update='cargo install-update -a' + +# Python Aliases + + +# YouTube Aliases +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'" + +# Use doas +alias sudo='echo "use doas idiot" ||' diff --git a/shells/.config/shells/functions b/shells/.config/shells/functions new file mode 100644 index 0000000..16f320b --- /dev/null +++ b/shells/.config/shells/functions @@ -0,0 +1,8 @@ +# LF Functions +LFCD="$HOME/.local/bin/lfcd" +if [ -f "$LFCD" ]; then + source "$LFCD" +fi + +# MD Function +function md { mkdir -pv "$1" && cd "$1"; } diff --git a/shells/.config/shells/shellsrc b/shells/.config/shells/shellsrc new file mode 100644 index 0000000..81a288d --- /dev/null +++ b/shells/.config/shells/shellsrc @@ -0,0 +1,10 @@ +# History settings +HISTFILE=$HOME/.config/shells/history +HISTSIZE=50000 +SAVEHIST=50000 + +# Aliases +source $HOME/.config/shells/aliases + +# Functions +source $HOME/.config/shells/functions diff --git a/shells/.config/zsh/zshrc b/shells/.config/zsh/zshrc new file mode 100644 index 0000000..833aadf --- /dev/null +++ b/shells/.config/zsh/zshrc @@ -0,0 +1,45 @@ +# Common configs +source $HOME/.config/shells/shellsrc + +# Syntax highlighting +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + +# Colors settings +autoload -U colors && colors + +# Completion +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) + +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 + +# Vi mode +bindkey -v + +# Key bindings +bindkey -s '^o' 'lf\n' +bindkey -s '^v' 'v\n' + +# Fix Cursor Shape After Using Neovim +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" ;} + +# Eval Zoxide +eval "$(zoxide init zsh)" + +# Eval FZF +source <(fzf --zsh) + +# Prompt +eval "$(starship init zsh)" diff --git a/shells/.zprofile b/shells/.zprofile new file mode 100644 index 0000000..48100df --- /dev/null +++ b/shells/.zprofile @@ -0,0 +1,2 @@ +# Fix GPG TTY Error +export GPG_TTY=$(tty) diff --git a/shells/.zshrc b/shells/.zshrc new file mode 100644 index 0000000..ffc6cc8 --- /dev/null +++ b/shells/.zshrc @@ -0,0 +1 @@ +source $HOME/.config/zsh/zshrc diff --git a/shells/README.org b/shells/README.org new file mode 100644 index 0000000..7b5f8ed --- /dev/null +++ b/shells/README.org @@ -0,0 +1,467 @@ +#+TITLE: My Shells Configs +#+AUTHOR: Naz <ndpm13@ch-naseem.com> +#+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 +<<basic-aliases>> + +# XBPS Aliases +<<xbps-aliases>> + +# Cargo Aliases +<<cargo-aliases>> + +# Python Aliases +<<python-aliases>> + +# YouTube Aliases +<<youtube-aliases>> + +# Use doas +<<sudo-alias>> +#+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 +<<lf-functions>> + +# MD Function +<<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 +<<config-history>> + +# Aliases +<<source-aliases>> + +# Functions +<<source-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 +<<source-shellsrc>> + +# Syntax highlighting +<<zsh-syntax-highlighting>> + +# Colors settings +<<zsh-colors>> + +# Completion +<<zsh-completion>> + +<<zsh-completion-vi>> + +# Vi mode +<<zsh-vi>> + +# Key bindings +<<zsh-key-bindings>> + +# Fix Cursor Shape After Using Neovim +<<zsh-nvim-cursor>> + +# Eval Zoxide +<<zsh-eval-zoxide>> + +# Eval FZF +<<zsh-eval-fzf>> + +# Prompt +<<zsh-starship-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 +<<source-shellsrc>> + +# Completion +<<bash-completion>> + +# Vi mode +<<bash-vi>> + +# Eval Zoxide +<<bash-eval-zoxide>> + +# Eval FZF +<<bash-eval-fzf>> + +# Prompt +<<bash-simple-prompt>> +#+end_src |
