summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autoenv/autoenv.plugin.zsh11
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh16
-rw-r--r--plugins/common-aliases/common-aliases.plugin.zsh6
-rw-r--r--plugins/dircycle/dircycle.plugin.zsh41
-rw-r--r--plugins/git-prompt/git-prompt.plugin.zsh3
-rw-r--r--plugins/jump/jump.plugin.zsh1
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh2
-rw-r--r--plugins/sudo/sudo.plugin.zsh5
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh8
9 files changed, 72 insertions, 21 deletions
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
index ca5666979..a8271849e 100644
--- a/plugins/autoenv/autoenv.plugin.zsh
+++ b/plugins/autoenv/autoenv.plugin.zsh
@@ -1,6 +1,17 @@
+# Activates autoenv or reports its failure
+if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
+ echo '-------- AUTOENV ---------'
+ echo 'Could not find ~/.autoenv/activate.sh.'
+ echo 'Please check if autoenv is correctly installed.'
+ echo 'In the meantime the autoenv plugin is DISABLED.'
+ echo '--------------------------'
+ return 1
+fi
+
# The use_env call below is a reusable command to activate/create a new Python
# virtualenv, requiring only a single declarative line of code in your .env files.
# It only performs an action if the requested virtualenv is not the current one.
+
use_env() {
typeset venv
venv="$1"
diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index f3d7ec2df..797554a13 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -7,3 +7,19 @@
# Arch Linux command-not-found support, you must have package pkgfile installed
# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
+
+# Fedora command-not-found support
+if [ -f /usr/libexec/pk-command-not-found ]; then
+ command_not_found_handler () {
+ runcnf=1
+ retval=127
+ [ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
+ [ ! -x /usr/libexec/packagekitd ] && runcnf=0
+ if [ $runcnf -eq 1 ]
+ then
+ /usr/libexec/pk-command-not-found $@
+ retval=$?
+ fi
+ return $retval
+ }
+fi
diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh
index 90d59910c..e3830adcf 100644
--- a/plugins/common-aliases/common-aliases.plugin.zsh
+++ b/plugins/common-aliases/common-aliases.plugin.zsh
@@ -20,12 +20,6 @@ alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
alias t='tail -f'
-# because typing 'cd' is A LOT of work!!
-alias ..='cd ../'
-alias ...='cd ../../'
-alias ....='cd ../../../'
-alias .....='cd ../../../../'
-
# Command line head / tail shortcuts
alias -g H='| head'
alias -g T='| tail'
diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh
index c6b6ba785..1e31105b1 100644
--- a/plugins/dircycle/dircycle.plugin.zsh
+++ b/plugins/dircycle/dircycle.plugin.zsh
@@ -1,10 +1,37 @@
-##
-# dircycle plugin: enables cycling through the directory
-# stack using Ctrl+Shift+Left/Right
+# enables cycling through the directory stack using
+# Ctrl+Shift+Left/Right
+#
+# left/right direction follows the order in which directories
+# were visited, like left/right arrows do in a browser
-eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }"
+# NO_PUSHD_MINUS syntax:
+# pushd +N: start counting from left of `dirs' output
+# pushd -N: start counting from right of `dirs' output
+
+insert-cycledleft () {
+ emulate -L zsh
+ setopt nopushdminus
+
+ builtin pushd -q +1 &>/dev/null || true
+ zle reset-prompt
+}
zle -N insert-cycledleft
-bindkey "\e[1;6D" insert-cycledleft
-eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q +0'; zle accept-line }"
+
+insert-cycledright () {
+ emulate -L zsh
+ setopt nopushdminus
+
+ builtin pushd -q -0 &>/dev/null || true
+ zle reset-prompt
+}
zle -N insert-cycledright
-bindkey "\e[1;6C" insert-cycledright
+
+
+# add key bindings for iTerm2
+if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
+ bindkey "^[[1;6D" insert-cycledleft
+ bindkey "^[[1;6C" insert-cycledright
+else
+ bindkey "\e[1;6D" insert-cycledleft
+ bindkey "\e[1;6C" insert-cycledright
+fi \ No newline at end of file
diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
index 01b8a88d9..d868a5fe1 100644
--- a/plugins/git-prompt/git-prompt.plugin.zsh
+++ b/plugins/git-prompt/git-prompt.plugin.zsh
@@ -2,9 +2,6 @@
# http://github.com/olivierverdier/zsh-git-prompt
#
export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
-# Initialize colors.
-autoload -U colors
-colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
index b16814fe4..d082c11e5 100644
--- a/plugins/jump/jump.plugin.zsh
+++ b/plugins/jump/jump.plugin.zsh
@@ -27,7 +27,6 @@ unmark() {
rm -i "$MARKPATH/$1"
}
-autoload colors
marks() {
for link in $MARKPATH/*(@); do
local markname="$fg[cyan]${link:t}$reset_color"
diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
index e472578b0..4fa6fcc34 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -5,7 +5,7 @@
# Flag indicating if we've previously jumped to last directory.
typeset -g ZSH_LAST_WORKING_DIRECTORY
mkdir -p $ZSH_CACHE_DIR
-local cache_file="$ZSH_CACHE_DIR/last-working-dir"
+cache_file="$ZSH_CACHE_DIR/last-working-dir"
# Updates the last directory once directory is changed.
function chpwd() {
diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh
index d12e06853..e3ba39918 100644
--- a/plugins/sudo/sudo.plugin.zsh
+++ b/plugins/sudo/sudo.plugin.zsh
@@ -13,9 +13,8 @@
# ------------------------------------------------------------------------------
sudo-command-line() {
-[[ -z $BUFFER ]] && zle up-history
-[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
-zle end-of-line
+ [[ -z $BUFFER ]] && zle up-history
+ [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER"
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 3ed32b3fb..f2745b409 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -14,6 +14,14 @@ function zle-keymap-select zle-line-init zle-line-finish {
zle -R
}
+# Ensure that the prompt is redrawn when the terminal size changes.
+TRAPWINCH() {
+ if [[ -o zle ]]; then
+ zle reset-prompt
+ zle -R
+ fi
+}
+
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select