From a8368426c419f2507140fadfde0686ecabe1f6ea Mon Sep 17 00:00:00 2001 From: opal <847966@proton.me> Date: Mon, 5 Sep 2022 19:19:25 -0400 Subject: [PATCH] switched to ohmyzsh --- .config/sway/config | 8 +- .config/zsh/.zshrc | 180 +++++++++++--------------------------- .config/zsh/zsh_aliases | 7 +- .config/zsh/zsh_functions | 14 +-- 4 files changed, 64 insertions(+), 145 deletions(-) diff --git a/.config/sway/config b/.config/sway/config index 63d4f96..95a2081 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -158,7 +158,7 @@ bindsym $mod+Shift+e exec swaynag -t custom -m 'What action would you like to pe exec_always dunst # flash focus -exec_always flashfocus +exec_always --no-startup-id flashfocus # Wlsunset (Night Light) exec_always wlsunset -l 47.6 -L -122.3 -t 3000 -T 6500 @@ -178,7 +178,6 @@ exec /usr/bin/blueman-applet # polkit #exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 - # Gtk # exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK # exec hash dbus-update-activation-environment 2>/dev/null && \ @@ -245,9 +244,8 @@ bindswitch --reload --locked lid:off output $laptop enable #output HDMI-A-1 pos 0 0 res 2560x1440 # Wallpaper -output HDMI-A-2 bg /home/opal/.config/wallpapers/3.jpg fill #050402 -output HDMI-A-1 bg /home/opal/.config/wallpapers/3.jpg fill #050402 -output eDP-1 pos 740 1440 res 1920x1200 bg ~/opalfiles/.config/wallpapers/buffalo.jpg fill scale 1 +output DP-3 bg /home/opal/.config/wallpapers/3.jpg fill +output HDMI-A-1 bg /home/opal/.config/wallpapers/3.jpg fill # Assign workspaces to numbers set $ws1 number 1 diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 62eae22..4bba532 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,139 +1,57 @@ -#### ~~~~ General ~~~~ ##### -HISTFILE=$XDG_CONFIG_HOME/zsh/.history +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH -#### ~~~~ Path Additions ~~~~ ##### -export PATH=/home/opal/scripts:$PATH # Scripts -export PATH=/home/opal/.config/emacs/bin:$PATH # Doom Path -export PATH=/home/opal/.local/bin:$PATH # .local path -export PATH=/home/opal/.local/share/gem/ruby/3.0.0/bin:$PATH # Ruby +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.config/oh-my-zsh" +export PATH=$HOME/.config/emacs/bin:$PATH # Doom Path +export PATH=$HOME/.local/bin:$PATH +export PATH=$HOME/bin:$PATH -#### ~~~~ Locale ~~~~ ##### +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +#You may need to manually set your language environment export LANG=en_US.UTF-8 -# #### ~~~~ Import ~~~~ ##### + ALIAS_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_aliases" FUNCTION_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_functions" . $ALIAS_LOCATION . $FUNCTION_LOCATION - -#### ~~~~ Prompt ~~~~ #### -git_prompt_status() { - local INDEX STATUS - - INDEX=$(command git status --porcelain -b 2> /dev/null) - - STATUS="" - - if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" - fi - - if $(echo "$INDEX" | grep '^A ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - fi - - if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - fi - - if $(echo "$INDEX" | grep '^R ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" - fi - - if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - fi - - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS" - fi - - if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" - fi - - if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" - fi - - if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" - fi - - if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" - fi - - if [[ ! -z "$STATUS" ]]; then - echo " [ $STATUS]" - fi -} - - -prompt_git_branch() { - autoload -Uz vcs_info - precmd_vcs_info() { vcs_info } - precmd_functions+=( precmd_vcs_info ) - setopt prompt_subst - zstyle ':vcs_info:git:*' formats '%b' -} - -prompt_git_info() { - [ ! -z "$vcs_info_msg_0_" ] && echo "$ZSH_THEME_GIT_PROMPT_PREFIX%F{white}$vcs_info_msg_0_%f$ZSH_THEME_GIT_PROMPT_SUFFIX" -} - -prompt_purity_precmd() { - # Pass a line before each prompt - print -P '' -} - -prompt_purification_setup() { - # Display git branch - - autoload -Uz add-zsh-hook - add-zsh-hook precmd prompt_purity_precmd - - ZSH_THEME_GIT_PROMPT_PREFIX=" %F{red}λ%f:" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - ZSH_THEME_GIT_PROMPT_ADDED="%F{green}+%f " - ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue}%f " - ZSH_THEME_GIT_PROMPT_DELETED="%F{red}x%f " - ZSH_THEME_GIT_PROMPT_RENAMED="%F{magenta}➜%f " - ZSH_THEME_GIT_PROMPT_UNMERGED="%F{yellow}═%f " - ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{white}%f " - ZSH_THEME_GIT_PROMPT_STASHED="%B%F{red}%f%b " - ZSH_THEME_GIT_PROMPT_BEHIND="%B%F{red}%f%b " - ZSH_THEME_GIT_PROMPT_AHEAD="%B%F{green}%f%b " - - prompt_git_branch - RPROMPT='$(prompt_git_info) $(git_prompt_status)' - PROMPT=$'%F{white}%~ %B%F{blue}>%f%b ' -} - -prompt_purification_setup - -source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh - -bindkey "^[[1;5C" forward-word -bindkey "^[[1;5D" backward-word - -#source <(kubectl completion zsh) -export PATH="$PATH:/root/.local/bin" -bindkey "^[[1;5C" forward-word -bindkey "^[[1;5D" backward-word diff --git a/.config/zsh/zsh_aliases b/.config/zsh/zsh_aliases index 3046ea2..cec124d 100644 --- a/.config/zsh/zsh_aliases +++ b/.config/zsh/zsh_aliases @@ -1,14 +1,15 @@ -# ~ Pacman ~ # -alias install="sudo dnf -y install" +# ~ DNF ~ # +alias install="sudo dnf install" alias remove="sudo dnf remove" alias search="dnf search" alias update="sudo dnf update" # ~ Commands ~ # alias ip="ip -c" +alias cpv='rsync -ah --info=progress2' # ~ Heck the GNU Coreutils ~ # -alias ls="exa -la" +alias ls="exa" alias cat="bat -p" alias df="duf" diff --git a/.config/zsh/zsh_functions b/.config/zsh/zsh_functions index 59b5470..643134b 100644 --- a/.config/zsh/zsh_functions +++ b/.config/zsh/zsh_functions @@ -1,7 +1,9 @@ -# Make directory and CD into i. -mkcd () { mkdir -p -- "$1" && cd -P -- "$1" } +# Make directory and `cd` into it. +mkcd() { + mkdir -p -- "$1" && cd -P -- "$1" +} -ls-awk () { ls -l --color=always | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \ - *2^(8-i));if(k)printf("%0o ",k);print}' } - -dog-dig () { dog "$1" A AAAA MX NS TXT SOA } +# cd & ls +cs() { + cd "$@" && ls +}