Browse Source

updated config to include colors

master
Yessiest 2 years ago
parent
commit
39d5b9b1b0
  1. 7
      .zshrc
  2. 61
      .zshrc.d/02-aliases.zsh
  3. 15
      .zshrc.d/03-completion.zsh
  4. 12
      .zshrc.d/04-bindings.zsh
  5. 10
      .zshrc.d/05-highlight.zsh
  6. 2
      .zshrc.d/06-color-aliases.zsh

7
.zshrc

@ -10,6 +10,10 @@ case $TERM in (xterm*)
TERM=xterm-256color
esac
if [ -f $HOME/.profile ]; then
source $HOME/.profile
fi
# Source local zsh configs
if [ -f $HOME/.zshrc_local ]; then
source $HOME/.zshrc_local
@ -25,7 +29,7 @@ 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')]}"
HOST_COLOR="${HOST_COLORS[$(cat /etc/hostname | tr -d '\n')]}"
fi
# Default to none if not defined
@ -60,3 +64,4 @@ for plugin in $PLUGINS; do
source $plugin
fi
done

61
.zshrc.d/02-aliases.zsh

@ -5,24 +5,63 @@ 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"
# winver is a thing, so here's linver
alias linver="nohup zenity --info --text=\"Linux version: \\n$(uname -srm)\" > /dev/null"
# tools to manipulate xclip easier
alias paste="xclip -o -selection clipboard"
alias copy="xclip -o | xclip -i -selection clipboard"
fi
# unless you're using vim to this day, this is what most people do
alias vim="nvim"
function nojail() {
# specific tool for firejail to disable jailing at all
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"
}
# Set a default music path
if [ -z "$MUSIC_PATH" ]; then
export MUSIC_PATH="$HOME/Music/"
fi
# Try to be sensible about youtube-dl downloader
if ! which yt-dlp > /dev/null; then
if ! which youtube-dl > /dev/null; then
alias yt-dlp="echo Unable to execute: youtube-dl or yt-dlp not found; false "
else
# No, really. Not even an ad, it just runs faster because people keep fixing the throttling issue, which youtube-dl got stuck on.
alias yt-dlp="echo youtube-dl is heavily outdated, consider installing yt-dlp; youtube-dl "
fi
fi
function ytdl() {
# Download and convert to audio a youtube video
if [ -z "$1" ]; then
echo "USAGE: ytdl <video name or URL>"
return
fi
mkdir -p $MUSIC_PATH/ytdl
yt-dlp -x --default-search "ytsearch:" --output "$MUSIC_PATH/ytdl/%(title)s.%(ext)s" $1
}
function scdl() {
# Download audio from soundcloud
if [ -z "$1" ]; then
echo "USAGE: scdl <audio name or URL>"
return
fi
mkdir -p $MUSIC_PATH/soundclown
yt-dlp -x --default-search "scsearch:" --output "$MUSIC_PATH/soundclown/%(title)s.%(ext)s" $1
}
function countlines() {
if [ -z "$1" ]; then
echo "USAGE: countlines <file extension>"
return
fi
for file in $(find . -name \*.$1); do
cat $file
done | wc -l
}

15
.zshrc.d/03-completion.zsh

@ -1,3 +1,5 @@
autoload bashcompinit
bashcompinit
autoload -Uz compinit
compinit
# ZSH menu styling
@ -6,14 +8,19 @@ 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
zstyle ':completion:*' menu select
zstyle ':completion:*' group-name ''
# Colors for descriptions
zstyle ':completion:*:*:*:*:descriptions' format '%F{green} %d:%f'
zstyle ':completion:*:*:*:*:corrections' format '%F{yellow} %d (errors: %e):%f'
zstyle ':completion:*:*:*:*:descriptions' format '%F{green} %B%d%b:%f'
zstyle ':completion:*:*:*:*:corrections' format '%F{yellow} %B%d%b (errors: %e):%f'
# Custom coloring for options
zstyle ':completion:*:options' list-colors '=(#b)*(-- *)=0=38;5;241'
zstyle ':completion:*:commands' list-colors '=(#b)*(-- *)=0=38;5;241'
# wtf git
zstyle ':completion:*:*:git*' 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}
setopt GLOB_COMPLETE LIST_ROWS_FIRST

12
.zshrc.d/04-bindings.zsh

@ -3,6 +3,12 @@ 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
if echo "$TERM" | grep xterm >> /dev/null; then
# Applies specifically to xterm - tested on st, and it doesn't seem to work
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
else
# Applies to all terminals (hopefully)
bindkey '^[[H' beginning-of-line #Home goes to the beginning of the line
bindkey '^[[4~' end-of-line #End goes to the end of the line
fi

10
.zshrc.d/05-highlight.zsh

@ -0,0 +1,10 @@
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
typeset -A ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]="fg=magenta"
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]="fg=magenta"
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument-unclosed]="fg=cyan"

2
.zshrc.d/06-color-aliases.zsh

@ -0,0 +1,2 @@
alias ip="ip --color=auto"
alias ls="ls --color=auto"
Loading…
Cancel
Save