From 8720932be24d5344e37a15742c80f6d2cbc2a332 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Sun, 20 Mar 2022 23:08:26 +0400 Subject: [PATCH] Added configs --- .zsh_host_colors | 3 ++ .zsh_user_colors | 3 ++ .zshrc | 62 ++++++++++++++++++++++++++++++++++++++ .zshrc.d/00-ls_colors.zsh | 11 +++++++ .zshrc.d/01-local-bin.zsh | 7 +++++ .zshrc.d/02-aliases.zsh | 28 +++++++++++++++++ .zshrc.d/03-completion.zsh | 19 ++++++++++++ .zshrc.d/04-bindings.zsh | 8 +++++ 8 files changed, 141 insertions(+) create mode 100644 .zsh_host_colors create mode 100644 .zsh_user_colors create mode 100644 .zshrc create mode 100644 .zshrc.d/00-ls_colors.zsh create mode 100644 .zshrc.d/01-local-bin.zsh create mode 100644 .zshrc.d/02-aliases.zsh create mode 100644 .zshrc.d/03-completion.zsh create mode 100644 .zshrc.d/04-bindings.zsh diff --git a/.zsh_host_colors b/.zsh_host_colors new file mode 100644 index 0000000..285565c --- /dev/null +++ b/.zsh_host_colors @@ -0,0 +1,3 @@ +# This file allows using custom colors for your hostname in the prompt +declare -A HOST_COLORS +HOST_COLORS[yessiest]=197 diff --git a/.zsh_user_colors b/.zsh_user_colors new file mode 100644 index 0000000..33cf544 --- /dev/null +++ b/.zsh_user_colors @@ -0,0 +1,3 @@ +# This file allows setting a custom color for your username in the prompt +declare -A USER_COLORS +USER_COLORS[yessiest]=14 diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..ce44211 --- /dev/null +++ b/.zshrc @@ -0,0 +1,62 @@ +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt notify +setopt extendedglob +unsetopt beep +bindkey -e +# Force xterm in 256 color mode +case $TERM in (xterm*) + TERM=xterm-256color +esac + +# Source local zsh configs +if [ -f $HOME/.zshrc_local ]; then + source $HOME/.zshrc_local +fi + +# Source modules +if [ -d "$HOME/.zshrc.d" ]; then + for sh in $HOME/.zshrc.d/*.zsh(N) ; do + [ -r "$sh" ] && source "$sh" + done +fi + +# Source color tags for hostnames +if [ -f $HOME/.zsh_host_colors ]; then + source $HOME/.zsh_host_colors + HOST_COLOR="${HOST_COLORS[$(hostname | tr -d '\n')]}" +fi + +# Default to none if not defined +if [ -z "$HOST_COLOR" ]; then + HOST_COLOR="none" +fi + +# Source color tags for usernames +if [ -f $HOME/.zsh_user_colors ]; then + source $HOME/.zsh_user_colors + USER_COLOR="${USER_COLORS[$USER]}" +fi + +# Default to none if not defined +if [ -z "$USER_COLOR" ]; then + USER_COLOR="none" +fi +# Prompt +PS1="%F{$USER_COLOR}%n%f@%F{$HOST_COLOR}%m %F{green}%/%f +$ " + +declare -a PLUGINS +PLUGINS=( + "/data/data/com.termux/files/usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh" + "/usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh" + "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" +) +declare -r PLUGINS + +for plugin in $PLUGINS; do + if [ -e "$plugin" ]; then + source $plugin + fi +done diff --git a/.zshrc.d/00-ls_colors.zsh b/.zshrc.d/00-ls_colors.zsh new file mode 100644 index 0000000..c56cd88 --- /dev/null +++ b/.zshrc.d/00-ls_colors.zsh @@ -0,0 +1,11 @@ +LS_COLORS="di=01;34" #directory color +LS_COLORS=$LS_COLORS":ln=01;36" #link color +LS_COLORS=$LS_COLORS":so=01;35" #socket color +LS_COLORS=$LS_COLORS":pi=40;33" #pipe color +LS_COLORS=$LS_COLORS":ex=32" #executable color +LS_COLORS=$LS_COLORS":bd=40;33" #block device color +LS_COLORS=$LS_COLORS":cd=40;33;01" #char device color +LS_COLORS=$LS_COLORS":su=37;41" #setuid executable color (i.e. sudo) +LS_COLORS=$LS_COLORS":sg=30;43" #setgid executable color +export LS_COLORS +alias ls="ls --color" diff --git a/.zshrc.d/01-local-bin.zsh b/.zshrc.d/01-local-bin.zsh new file mode 100644 index 0000000..84ba7fb --- /dev/null +++ b/.zshrc.d/01-local-bin.zsh @@ -0,0 +1,7 @@ +declare -a LOCAL_BINS +LOCAL_BINS=( "$HOME/.local/bin" "$HOME/Projects/env/bin" "/usr/local/bin" "/usr/local/sbin" ) +for bin in LOCAL_BINS; do + if [ -e $bin ]; then + $PATH="$PATH:$bin" + fi +done diff --git a/.zshrc.d/02-aliases.zsh b/.zshrc.d/02-aliases.zsh new file mode 100644 index 0000000..0684260 --- /dev/null +++ b/.zshrc.d/02-aliases.zsh @@ -0,0 +1,28 @@ +# Just a funky little collection of more or less useful aliases + +#Various impractical jokes and tools +if [ -n "$LOCALCITY" ]; then + alias weatherfetch="curl -sf https://wttr.in/$LOCALCITY | head -n 7 && echo ''" +fi +if [ -n "$DESKTOP_SESSION" ]; then + alias linuxver="nohup zenity --info --text=\"Linux version: \\n$(uname -srm)\" > /dev/null" + alias paste="xclip -o -selection clipboard" + alias copy="xclip -o | xclip -i -selection clipboard" +fi +alias vim="nvim" +function nojail() { + PATH=`echo $PATH | sed "s/:\/usr\/local\/bin//g" | sed "s/:\/usr\/local\/sbin//g"` $@ +} + +if which flashplayer > /dev/null; then + function z0rde() { + local id + id="$1" + if [ "$1" == "" ]; then + id="$((1 + $RANDOM % 8000))" + fi + echo $id + flashplayer "https://z0r.de/L/z0r-de_$id.swf" + } +fi + diff --git a/.zshrc.d/03-completion.zsh b/.zshrc.d/03-completion.zsh new file mode 100644 index 0000000..f422496 --- /dev/null +++ b/.zshrc.d/03-completion.zsh @@ -0,0 +1,19 @@ +autoload -Uz compinit +compinit +# ZSH menu styling +# Enabling completers, cache and menu with selection. +zstyle :compinstall filename '/home/yessiest/.zshrc' +zstyle ':completion:*' completer _extensions _complete _approximate +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path "$HOME/.cache/zsh/.zcompcache" +zstyle ':completion:*' menu select +# Colors for descriptions +zstyle ':completion:*:*:*:*:descriptions' format '%F{green} %d:%f' +zstyle ':completion:*:*:*:*:corrections' format '%F{yellow} %d (errors: %e):%f' +# Custom coloring for options +zstyle ':completion:*:options' list-colors '=(#b)*(-- *)=0=38;5;241' +# Custom coloring for processes +zstyle ':completion:*:processes' list-colors '=(#b) #([0-9]#)*( *[a-z])*=0=38;5;242=32' +# Colors for LS +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} + diff --git a/.zshrc.d/04-bindings.zsh b/.zshrc.d/04-bindings.zsh new file mode 100644 index 0000000..4fd38c5 --- /dev/null +++ b/.zshrc.d/04-bindings.zsh @@ -0,0 +1,8 @@ +# The default text editing behaviour +bindkey "^[[1;5C" forward-word #Ctrl+right goes forwards one word +bindkey "^[[1;5D" backward-word #Ctrl+left goes backwards one word +bindkey "^[[1;3C" forward-word #Alt+right goes forwards one word +bindkey "^[[1;3D" backward-word #Alt+left goes backwards one word +bindkey '^[[H' beginning-of-line #Home goes to the beginning of the line +bindkey '^[[F' end-of-line #End goes to the end of the line +