X-Git-Url: https://src.twobees.de/?a=blobdiff_plain;f=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Fmagic-enter%2Fmagic-enter.plugin.zsh;fp=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Fmagic-enter%2Fmagic-enter.plugin.zsh;h=0000000000000000000000000000000000000000;hb=1a8e170bbe5c6641a26ab1ce2e6ce6c5c1faa4cd;hp=55b893535ca3895ea91de3687acaf17dd1b650a8;hpb=475ba35502579302593f4735c853c49ef1845dcb;p=dotfiles.git diff --git a/stow/oh-my-zsh/.oh-my-zsh/plugins/magic-enter/magic-enter.plugin.zsh b/stow/oh-my-zsh/.oh-my-zsh/plugins/magic-enter/magic-enter.plugin.zsh deleted file mode 100644 index 55b8935..0000000 --- a/stow/oh-my-zsh/.oh-my-zsh/plugins/magic-enter/magic-enter.plugin.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# Default commands -: ${MAGIC_ENTER_GIT_COMMAND:="git status -u ."} # run when in a git repository -: ${MAGIC_ENTER_OTHER_COMMAND:="ls -lh ."} # run anywhere else - -magic-enter() { - # Only run MAGIC_ENTER commands when in PS1 and command line is empty - # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#User_002dDefined-Widgets - if [[ -n "$BUFFER" || "$CONTEXT" != start ]]; then - return - fi - - if command git rev-parse --is-inside-work-tree &>/dev/null; then - BUFFER="$MAGIC_ENTER_GIT_COMMAND" - else - BUFFER="$MAGIC_ENTER_OTHER_COMMAND" - fi -} - -# Wrapper for the accept-line zle widget (run when pressing Enter) - -# If the wrapper already exists don't redefine it -(( ! ${+functions[_magic-enter_accept-line]} )) || return 0 - -case "$widgets[accept-line]" in - # Override the current accept-line widget, calling the old one - user:*) zle -N _magic-enter_orig_accept-line "${widgets[accept-line]#user:}" - function _magic-enter_accept-line() { - magic-enter - zle _magic-enter_orig_accept-line -- "$@" - } ;; - # If no user widget defined, call the original accept-line widget - builtin) function _magic-enter_accept-line() { - magic-enter - zle .accept-line - } ;; -esac - -zle -N accept-line _magic-enter_accept-line