diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2022-06-16 15:19:16 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2022-06-16 15:19:16 -0500 |
commit | 66bff0b5ef46550866c959bb745a61363dc5331f (patch) | |
tree | accb0a1923bf9673d54bca84ee637ed536ae7b6a | |
parent | c878742ad78a014fef93c520abd1c1d846f2c0d9 (diff) | |
download | dotconfig-66bff0b5ef46550866c959bb745a61363dc5331f.tar.xz dotconfig-66bff0b5ef46550866c959bb745a61363dc5331f.zip |
zplug commit
-rw-r--r-- | zsh/profile/zprofile.G3N2 | 3 | ||||
-rw-r--r-- | zsh/profile/zprofile.librex60 | 2 | ||||
-rw-r--r-- | zsh/profile/zprofile.voidx250 | 2 | ||||
-rw-r--r-- | zsh/zplugs | 1 | ||||
-rw-r--r-- | zsh/zprofile | 7 | ||||
-rwxr-xr-x | zsh/zscripts/!rootcolors.zsh | 2 | ||||
-rwxr-xr-x | zsh/zscripts/.lfub.zsh (renamed from zsh/zscripts/lfub.zsh) | 0 | ||||
-rwxr-xr-x | zsh/zscripts/aliasrc.zsh | 4 | ||||
-rwxr-xr-x | zsh/zscripts/hosts/colors.voidx250.zsh (renamed from zsh/zscripts/colors.voidx250.zsh) | 0 | ||||
-rwxr-xr-x | zsh/zscripts/keybindrc.zsh | 3 | ||||
-rwxr-xr-x | zsh/zscripts/zplug.zsh | 116 | ||||
-rwxr-xr-x | zsh/zshrc | 7 |
12 files changed, 130 insertions, 17 deletions
diff --git a/zsh/profile/zprofile.G3N2 b/zsh/profile/zprofile.G3N2 index afe7c77..4bcfddc 100644 --- a/zsh/profile/zprofile.G3N2 +++ b/zsh/profile/zprofile.G3N2 @@ -1,6 +1,3 @@ #!/usr/bin/env zsh -export ZPLUGINS="/home/timmy/.local/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" -export JAVA_HOME=/usr/lib/jvm/openjdk-bin-11 - source /home/timmy/.config/zsh/zprofile diff --git a/zsh/profile/zprofile.librex60 b/zsh/profile/zprofile.librex60 index 18860a5..543038c 100644 --- a/zsh/profile/zprofile.librex60 +++ b/zsh/profile/zprofile.librex60 @@ -2,6 +2,4 @@ export PATH="/usr/local/texlive/2021/bin/x86_64-linux:$PATH" -export ZPLUGINS="/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - source /home/timmy/.config/zsh/zprofile diff --git a/zsh/profile/zprofile.voidx250 b/zsh/profile/zprofile.voidx250 index 733bf92..1012463 100644 --- a/zsh/profile/zprofile.voidx250 +++ b/zsh/profile/zprofile.voidx250 @@ -1,7 +1,5 @@ #!/usr/bin/env zsh -export ZPLUGINS="/home/timmy/.local/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" - export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:$XDG_DATA_DIRS" source /home/timmy/.config/zsh/zprofile diff --git a/zsh/zplugs b/zsh/zplugs new file mode 100644 index 0000000..845f5c6 --- /dev/null +++ b/zsh/zplugs @@ -0,0 +1 @@ +https://github.com/zdharma-continuum/fast-syntax-highlighting diff --git a/zsh/zprofile b/zsh/zprofile index 1576f84..b37c4ac 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -3,7 +3,7 @@ # Default programs: export EDITOR='nvim' export TERMINAL='st' -export BROWSER='launch brave' +export BROWSER='launch firefox' # Clean up home directory export XDG_CACHE_HOME="$HOME/.cache" @@ -21,13 +21,14 @@ export XDG_DATA_HOME="$HOME/.local/share" export CARGO_HOME="$XDG_DATA_HOME/cargo" export GNUPGHOME="$XDG_DATA_HOME/gnupg" export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" -export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_DATA_HOME/java" export ZDATADIR="$XDG_DATA_HOME/zsh" # User env +export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_DATA_HOME/java" export LESSHISTFILE='-' # Path for lbin in "$HOME/.local/bin"{/,/*/}; do export PATH="${lbin%/}:$PATH"; done # Add ~/.local/bin and all sub dirs +export PATH="$HOME/.local/opt:$PATH" export PATH="$CARGO_HOME/bin:$PATH" # Theming @@ -37,4 +38,4 @@ export QT_QPA_PLATFORMTHEME='qt5ct' mkdir -p "$ZDATADIR" # Autostart X after login -[ -z $DISPLAY ] && [[ "$(id -u)" != 0 ]] && [[ $TTY =~ /dev/tty(1|C0) ]] && startx $XINITRC +[ -z $DISPLAY ] && [[ $EUID != 0 ]] && [[ $TTY =~ /dev/tty(1|C0) ]] && startx $XINITRC diff --git a/zsh/zscripts/!rootcolors.zsh b/zsh/zscripts/!rootcolors.zsh index 6ad30a7..d146aa5 100755 --- a/zsh/zscripts/!rootcolors.zsh +++ b/zsh/zscripts/!rootcolors.zsh @@ -1,3 +1,3 @@ #!/usr/bin/env zsh -[ $(id -u) = 0 ] && declare col{br,name,at,host,dir}=red && clear # Clear to get rid of last login message +[ $EUID = 0 ] && declare col{br,name,at,host,dir}=red && clear # Clear to get rid of last login message diff --git a/zsh/zscripts/lfub.zsh b/zsh/zscripts/.lfub.zsh index 83b00c1..83b00c1 100755 --- a/zsh/zscripts/lfub.zsh +++ b/zsh/zscripts/.lfub.zsh diff --git a/zsh/zscripts/aliasrc.zsh b/zsh/zscripts/aliasrc.zsh index cd77a71..e008cc8 100755 --- a/zsh/zscripts/aliasrc.zsh +++ b/zsh/zscripts/aliasrc.zsh @@ -22,6 +22,7 @@ alias \ vrc="nvim ~/.config/nvim/init.vim" \ xrc="cd ~/.config/x11" \ zrc="cd ~/.config/zsh" \ + zhist="vim ~/.local/share/zsh/zhistory" \ # Power scripts alias \ @@ -51,10 +52,13 @@ alias \ # Miscellaneous alias \ + yt-dlp-album="yt-dlp -x -o '%(uploader)s (%(upload_date>%Y)s) - %(playlist_title)s%%%(playlist_index)s - %(title)s.%(ext)s'" \ yt-dlp="yt-dlp -o '%(uploader)s - %(title)s.%(ext)s'" \ # Clean home directory alias \ + mbsync="mbsync --config $MBSYNCRC" \ startdwm="startx $XDG_CONFIG_HOME/x11/xinitdwmrc" \ + startpfwm="startx $XDG_CONFIG_HOME/x11/xinitpicframewmrc" \ startx="startx $XINITRC" \ diff --git a/zsh/zscripts/colors.voidx250.zsh b/zsh/zscripts/hosts/colors.voidx250.zsh index cf710f3..cf710f3 100755 --- a/zsh/zscripts/colors.voidx250.zsh +++ b/zsh/zscripts/hosts/colors.voidx250.zsh diff --git a/zsh/zscripts/keybindrc.zsh b/zsh/zscripts/keybindrc.zsh index 29913ae..1f0e93a 100755 --- a/zsh/zscripts/keybindrc.zsh +++ b/zsh/zscripts/keybindrc.zsh @@ -4,9 +4,6 @@ bindkey -v export KEYTIMEOUT=1 -# Unbind some default keybindings -#bindkey -r "^U" "^W" "^G" "^J" "^Q" "^R" "^[[200~" - # Keybindings autoload edit-command-line; zle -N edit-command-line # Edit line in Vim buffer bindkey '^E' edit-command-line # Ctrl-e - edit line in Vim buffer diff --git a/zsh/zscripts/zplug.zsh b/zsh/zscripts/zplug.zsh new file mode 100755 index 0000000..e1fa3c6 --- /dev/null +++ b/zsh/zscripts/zplug.zsh @@ -0,0 +1,116 @@ +#!/usr/bin/env zsh + +local zplugs="${ZDOTDIR:-~/.}${ZDOTDIR+/}zplugs" +local zplugins="${ZDATADIR:-.local/share/zsh}/zplugins" + +unsetopt nomatch # Disable error message when no file can be found + +function __zplugInstall() { + touch "$zplugs" + local pluglist=( `cat "$zplugs"` ) + shift + for plug in "$@"; do + pluglist[$((${#pluglist[@]}+1))]=$plug + done + + mkdir -p "$zplugins" + + for plug in ${pluglist[@]}; do + [ -d "$zplugins/$(basename -s'.git' "$plug")" ] && continue + if ! `git -C "$zplugins" clone "$plug" "$(basename -s'.git' "$plug")"`; then + vared -p "Remove \"$plug\"? [y|n]: " -c confirm + [ "$confirm" =~ (y|yes) ] && pluglist=(${pluglist#$plug}) \ + && echo "Repo Deleted" \ + || echo "Repo Kept" + confirm="" + fi + echo + done + for plug in ${pluglist[@]}; do echo "$plug"; done | sort -u > "$zplugs" + echo "All plugins installed and saved to $zplugs!\nDone" +} + +function __zplugUninstall() { + mkdir -p "$zplugins" + local pluglist=( `cat "$zplugs"` ) + [ -z "$pluglist" ] && echo "No packages are installed!" && return + echo "Listing all packages in $zplugins ..." + local pluglistbn=() + for i in {1..${#pluglist[@]}}; do + pluglistbn[$i]="$(basename -s'.git' "${pluglist[$i]}")" + printf '%3d) %s\n' $i "${pluglistbn[$i]}" + done + + echo + vared -p "Choose zsh plugin(s) to remove: " -c plugids + + echo "\nListing selected plugins:" + for plugid in $=plugids; do + if [ -z ${pluglist[$plugid]} ]; then + echo "Error: input \"$plugid\" is not a valid plugin identifier" + return + fi + printf " " + echo "${pluglistbn[$plugid]}" + done + + echo + vared -p "Really remove all of these plugins? [y|n]: " -c confirm + case $confirm in + y|yes) ;; + n|no) echo "Aborted" && return ;; + *) echo "Input not understood\nAborted" && return ;; + esac + for plugid in $=plugids; do + printf " " + rm -vrf "$zplugins/${pluglistbn[$plugid]}" + pluglist[$plugid]="" + done + for plug in ${pluglist[@]}; do echo "$plug"; done | sort -u > "$zplugs" + echo "\nDone" +} + +function __zplugUpgrade() { + mkdir -p "$zplugins" + echo "Upgrading all packages...\n" + for plugdir in "$zplugins"/*; do; + basename "$plugdir" + git -C "$plugdir" pull; + echo + done + echo "Done" +} + +function __zplugList() { + mkdir -p "$zplugins" + echo "Listing all packages...\n" + ls "$zplugins" | nl -s') ' -w3 + echo "\nDone" +} + +function __zplugHelp() { + echo "Usage: zplug [install/add/i|uninstall/remove/r|upgrade/update/u|list/l|help/h] + zplug install, add, i [packages] : Add any packages listed to $zplugs file and install all plugins + zplug uninstall, remove, r : Interactively remove packages. Removes package from config file as well + zplug upgrade, update, u : Update all installed packages + zplug list, l : List all installed packages + zplug help, h : Show this help menu + + To use zplug, just put \"zplugInitialize\" as the last line of your zshrc!" +} + +function zplug() { + local cmd=${1:-h} + case $cmd in + install|add|i) __zplugInstall $@ ;; + uninstall|remove|r) __zplugUninstall ;; + upgrade|update|u) __zplugUpgrade ;; + list|l) __zplugList ;; + help|h) __zplugHelp ;; + *) echo "zplug: input \"$1\" not recognized!" && __zplugHelp ;; + esac +} + +function zplugInitialize() { + for plugin in "$zplugins"/*/*.zsh; do source "$plugin"; done +} @@ -1,6 +1,7 @@ #!/usr/bin/env zsh # Zsh scripts +unsetopt nomatch # Disable error message when no files can be found for zscript in "$XDG_CONFIG_HOME/zsh/zscripts"{/[^\!]*.zsh,/hosts/*.$HOST.zsh,/!*.zsh}; do source "$zscript"; done # Colors! + Prompt @@ -21,7 +22,7 @@ setopt EXTENDED_HISTORY # Save superfluous info with command to reduce disk wri # Other settings setopt autocd # 'cd' is implied -"/home/timmy/.local/opt/shell-color-scripts/colorscripts/$(ls /home/timmy/.local/opt/shell-color-scripts/colorscripts 2>/dev/null | shuf -n1)" 2>/dev/null +# tmp thing +[ $TTY = /dev/tty2 ] && "/home/timmy/.local/opt/shell-color-scripts/colorscripts/$(ls /home/timmy/.local/opt/shell-color-scripts/colorscripts 2>/dev/null | shuf -n1)" 2>/dev/null -# Load zsh plugins; should be last -for plugin in ${=ZPLUGINS}; do source "$plugin"; done +zplugInitialize # Load zsh plugins using zplug; should be last |