summaryrefslogtreecommitdiff
path: root/zsh/zscripts
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zscripts')
-rwxr-xr-xzsh/zscripts/aliasrc.zsh8
-rwxr-xr-xzsh/zscripts/hosts/aliasrc.voidx250.zsh2
-rwxr-xr-xzsh/zscripts/hosts/colors.voidx250.zsh2
-rwxr-xr-xzsh/zscripts/keybindrc.zsh14
-rwxr-xr-xzsh/zscripts/zplug.zsh83
5 files changed, 63 insertions, 46 deletions
diff --git a/zsh/zscripts/aliasrc.zsh b/zsh/zscripts/aliasrc.zsh
index e008cc8..411a84d 100755
--- a/zsh/zscripts/aliasrc.zsh
+++ b/zsh/zscripts/aliasrc.zsh
@@ -4,7 +4,7 @@
alias \
htop="htim" \
mutt="neomutt" \
- sudo="doas" \
+ sudo="${SUDO-sudo}" \
# Shorten program names
alias \
@@ -58,7 +58,7 @@ alias \
# 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" \
+ startdwm="startx $X11CONFIG/xinitrc dwm" \
+ startpfwm="startx $X11CONFIG/xinitrc picframewm" \
+ startx="startx $X11CONFIG/xinitrc" \
diff --git a/zsh/zscripts/hosts/aliasrc.voidx250.zsh b/zsh/zscripts/hosts/aliasrc.voidx250.zsh
index 4681ace..4bb85ea 100755
--- a/zsh/zscripts/hosts/aliasrc.voidx250.zsh
+++ b/zsh/zscripts/hosts/aliasrc.voidx250.zsh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Replacement programs
+# Package Management
alias \
xi="sudo xbps-install" \
xq="xbps-query -R --search" \
diff --git a/zsh/zscripts/hosts/colors.voidx250.zsh b/zsh/zscripts/hosts/colors.voidx250.zsh
index cf710f3..910f1f9 100755
--- a/zsh/zscripts/hosts/colors.voidx250.zsh
+++ b/zsh/zscripts/hosts/colors.voidx250.zsh
@@ -1,3 +1,5 @@
+#!/usr/bin/env zsh
+
if [ -n "$DISPLAY" ]; then
declare col{br,at}=green
declare col{name,host}=76
diff --git a/zsh/zscripts/keybindrc.zsh b/zsh/zscripts/keybindrc.zsh
index 1f0e93a..67dfcd5 100755
--- a/zsh/zscripts/keybindrc.zsh
+++ b/zsh/zscripts/keybindrc.zsh
@@ -1,8 +1,8 @@
#!/usr/bin/env zsh
# Vi mode + requirements for ALL keybindings to work correctly
-bindkey -v
-export KEYTIMEOUT=1
+bindkey -v # Select viins keymap
+KEYTIMEOUT=1
# Keybindings
autoload edit-command-line; zle -N edit-command-line # Edit line in Vim buffer
@@ -19,10 +19,10 @@ bindkey '^[[M' delete-word # Ctrl-Delete - delete currect word in front of the
bindkey '\e[A' history-search-backward # Up arrow - seach history backwards
bindkey '\e[B' history-search-forward # Down arrow - seach history forwards
# Ctrl-vi keys emulate arrow keys
-bindkey '^H' emacs-backward-word # Ctrl-L - go back one word
-bindkey '^J' history-search-forward # Ctrl-J - seach history backwards
-bindkey '^K' history-search-backward # Ctrl-K - seach history forwards
-bindkey '^L' emacs-forward-word # Ctrl-H - go forward one word
+#bindkey '^H' emacs-backward-word # Ctrl-L - go back one word
+#bindkey '^J' history-search-forward # Ctrl-J - seach history backwards
+#bindkey '^K' history-search-backward # Ctrl-K - seach history forwards
+#bindkey '^L' emacs-forward-word # Ctrl-H - go forward one word
# Basic auto/tab complete
autoload -U compinit
@@ -39,4 +39,4 @@ bindkey -M menuselect '^j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# Ignore ctrl-d to exit shell
-setopt ignore_eof
+setopt IGNORE_EOF
diff --git a/zsh/zscripts/zplug.zsh b/zsh/zscripts/zplug.zsh
index e1fa3c6..6b86104 100755
--- a/zsh/zscripts/zplug.zsh
+++ b/zsh/zscripts/zplug.zsh
@@ -1,28 +1,28 @@
#!/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
+local zplugs="${ZDOTDIR:-~/.}${ZDOTDIR:+/}zplugs" # Declare videos using `local` to keep variables away from interactive shell
+local zplugins="${ZPLUGINSDIR:-/usr/local/share/zsh/zplugins}"
+[[ $EUID != 0 ]] && local sudo=${SUDO-sudo}
function __zplugInstall() {
touch "$zplugs"
- local pluglist=( `cat "$zplugs"` )
+ local pluglist=( `grep -v '#' "$zplugs"` )
+ local confirm plug
shift
- for plug in "$@"; do
- pluglist[$((${#pluglist[@]}+1))]=$plug
- done
+ for plug in "$@"; do; pluglist+=(${plug}); done
- mkdir -p "$zplugins"
+ $sudo 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=""
+ if ! `$sudo git -C "$zplugins" clone "$plug" "$(basename -s'.git' "$plug")"`; then
+ # Runs if git has an error
+ printf "Remove \"$plug\"? [y|n]: "
+ read confirm
+ case $confirm in
+ y|yes) pluglist=(${pluglist#$plug}) && echo "Repo Deleted" ;;
+ *) echo "Repo Kept" ;;
+ esac
fi
echo
done
@@ -31,18 +31,22 @@ function __zplugInstall() {
}
function __zplugUninstall() {
- mkdir -p "$zplugins"
- local pluglist=( `cat "$zplugs"` )
+ local pluglist=( `cat "$zplugs"` ) pluglistbn=()
+ local confirm i plug plugids plugig
+
[ -z "$pluglist" ] && echo "No packages are installed!" && return
+
+ $sudo mkdir -p "$zplugins"
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
+ printf "Choose zsh plugin(s) to remove: "
+ read plugids
+ [ -z "$plugids" ] && echo "No plugins selected\nAborting" && return
echo "\nListing selected plugins:"
for plugid in $=plugids; do
@@ -50,20 +54,19 @@ function __zplugUninstall() {
echo "Error: input \"$plugid\" is not a valid plugin identifier"
return
fi
- printf " "
- echo "${pluglistbn[$plugid]}"
+ echo "\t${pluglistbn[$plugid]}"
done
- echo
- vared -p "Really remove all of these plugins? [y|n]: " -c confirm
+ printf "\nReally remove all of these plugins? [y|n]: "
+ read 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]}"
+ printf '\t'
+ $sudo rm -vrf "$zplugins/${pluglistbn[$plugid]}"
pluglist[$plugid]=""
done
for plug in ${pluglist[@]}; do echo "$plug"; done | sort -u > "$zplugs"
@@ -71,11 +74,12 @@ function __zplugUninstall() {
}
function __zplugUpgrade() {
- mkdir -p "$zplugins"
+ local plugdir
+ $sudo mkdir -p "$zplugins"
echo "Upgrading all packages...\n"
for plugdir in "$zplugins"/*; do;
basename "$plugdir"
- git -C "$plugdir" pull;
+ $sudo git -C "$plugdir" pull;
echo
done
echo "Done"
@@ -90,13 +94,23 @@ function __zplugList() {
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
+ install, add, i [packages] : Install plugins from config file & add any new plugins
+ uninstall, remove, r : Interactively remove plugins
+ upgrade, update, u : Update all installed plugins
+ list, l : List all installed plugins
+ help, h : Show this help menu
+
+ All plugins are listed in $zplugs
+ All plugins are installed in $zplugins
+
+ To install a plugin, just put it in the zplug file and run \"zplug install\"
+ or just run \"zplug install [plugin]\" where [plugin] is a link to download the
+ plugin using git
+
+ For instance, \"https://github.com/zdharma-continuum/fast-syntax-highlighting\" is
+ a valid plugin link for the fast-syntax-highlighting plugin.
- To use zplug, just put \"zplugInitialize\" as the last line of your zshrc!"
+ To use your plugins, just put \"zplugInitialize\" as the last line of your zshrc!"
}
function zplug() {
@@ -112,5 +126,6 @@ function zplug() {
}
function zplugInitialize() {
- for plugin in "$zplugins"/*/*.zsh; do source "$plugin"; done
+ local plugin
+ for plugin in "$zplugins"/*/*.zsh; do source "$plugin"; done 2>/dev/null
}