diff options
Diffstat (limited to 'zsh/zscripts')
-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 |
6 files changed, 121 insertions, 4 deletions
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 +} |