summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/git.zsh6
-rw-r--r--plugins/firewalld/firewalld.plugin.zsh17
-rw-r--r--plugins/firewalld/readme.md22
-rw-r--r--plugins/npm/npm.plugin.zsh7
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh7
5 files changed, 54 insertions, 5 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index b9069ff12..f7eccb81d 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -165,13 +165,13 @@ function git_prompt_status() {
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
- if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
+ if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
fi
- if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
+ if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
fi
- if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
+ if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
fi
echo $STATUS
diff --git a/plugins/firewalld/firewalld.plugin.zsh b/plugins/firewalld/firewalld.plugin.zsh
new file mode 100644
index 000000000..bfbf6f48f
--- /dev/null
+++ b/plugins/firewalld/firewalld.plugin.zsh
@@ -0,0 +1,17 @@
+alias fw="sudo firewall-cmd"
+alias fwp="sudo firewall-cmd --permanent"
+alias fwr="sudo firewall-cmd --reload"
+alias fwrp="sudo firewall-cmd --runtime-to-permanent"
+
+function fwl () {
+ # converts output to zsh array ()
+ # @f flag split on new line
+ zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}")
+
+ for i in $zones; do
+ sudo firewall-cmd --zone $i --list-all
+ done
+
+ echo 'Direct Rules:'
+ sudo firewall-cmd --direct --get-all-rules
+}
diff --git a/plugins/firewalld/readme.md b/plugins/firewalld/readme.md
new file mode 100644
index 000000000..8b5bc74d4
--- /dev/null
+++ b/plugins/firewalld/readme.md
@@ -0,0 +1,22 @@
+# FirewallD Plugin
+
+This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
+
+```zsh
+plugins=(... firewalld)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| :---- | :----------------------------------------- | :--------------------------- |
+| fw | `sudo firewall-cmd` | Shorthand |
+| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
+| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
+| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
+
+## Functions
+
+| Function | Description |
+| :------- | :--------------------------------------------------------- |
+| fwl | Lists configuration from all active zones and direct rules |
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
index 30b91ec9c..02e4f3e93 100644
--- a/plugins/npm/npm.plugin.zsh
+++ b/plugins/npm/npm.plugin.zsh
@@ -2,10 +2,13 @@
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
- npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
+ npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
+ [[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
fi
- source $__NPM_COMPLETION_FILE
+ [[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
+
+ unset __NPM_COMPLETION_FILE
}
# Install dependencies globally
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 0e2af5dce..dee694b9a 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -28,6 +28,13 @@ bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
+# allow ctrl-r to perform backward search in history
+bindkey '^r' history-incremental-search-backward
+
+# allow ctrl-a and ctrl-e to move to beginning/end of line
+bindkey '^a' beginning-of-line
+bindkey '^e' end-of-line
+
# if mode indicator wasn't setup by theme, define default
if [[ "$MODE_INDICATOR" == "" ]]; then
MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"