[#23] Convert editor into a module

This commit is contained in:
Sorin Ionescu 2012-03-28 14:42:34 -04:00
parent 92816f6db7
commit 1330e6e792
4 changed files with 8 additions and 9 deletions

View file

@ -50,7 +50,6 @@ autoload -Uz compinit && compinit -i
source "${0:h}/helper.zsh" source "${0:h}/helper.zsh"
source "${0:h}/environment.zsh" source "${0:h}/environment.zsh"
source "${0:h}/terminal.zsh" source "${0:h}/terminal.zsh"
source "${0:h}/editor.zsh"
# Source modules defined in ~/.zshrc. # Source modules defined in ~/.zshrc.
for omodule in "$omodules[@]"; do for omodule in "$omodules[@]"; do

View file

@ -19,7 +19,7 @@ zstyle ':omz:prompt:vi' insert '>>>'
zstyle ':omz:prompt:vi' command '<<<' zstyle ':omz:prompt:vi' command '<<<'
# Indicator to notify of generating completion. # Indicator to notify of generating completion.
zstyle ':omz:editor' completing '...' zstyle ':omz:module:editor' completing '...'
# Beep on error in line editor. # Beep on error in line editor.
setopt BEEP setopt BEEP
@ -96,7 +96,7 @@ zle -N expand-dot-to-parent-directory-path
# Displays an indicator when completing. # Displays an indicator when completing.
function expand-or-complete-with-indicator { function expand-or-complete-with-indicator {
local indicator local indicator
zstyle -s ':omz:editor' completing 'indicator' zstyle -s ':omz:module:editor' completing 'indicator'
print -Pn "$indicator" print -Pn "$indicator"
zle expand-or-complete-prefix zle expand-or-complete-prefix
zle redisplay zle redisplay
@ -204,7 +204,7 @@ for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "$keyinfo[Control]I" expand-or-complete-prefix bindkey -M "$keymap" "$keyinfo[Control]I" expand-or-complete-prefix
# Expand .... to ../.. # Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:module:editor' dot-expansion; then
bindkey -M "$keymap" "." expand-dot-to-parent-directory-path bindkey -M "$keymap" "." expand-dot-to-parent-directory-path
fi fi
@ -217,12 +217,12 @@ for keymap in 'emacs' 'viins'; do
done done
# Do not expand .... to ../.. during incremental search. # Do not expand .... to ../.. during incremental search.
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:module:editor' dot-expansion; then
bindkey -M isearch . self-insert 2> /dev/null bindkey -M isearch . self-insert 2> /dev/null
fi fi
# Set the key layout. # Set the key layout.
zstyle -s ':omz:editor' keymap 'keymap' zstyle -s ':omz:module:editor' keymap 'keymap'
if [[ "$keymap" == (emacs|) ]]; then if [[ "$keymap" == (emacs|) ]]; then
bindkey -e bindkey -e
elif [[ "$keymap" == vi ]]; then elif [[ "$keymap" == vi ]]; then

View file

@ -6,10 +6,10 @@
# #
# Set the key mapping style to 'emacs' or 'vi'. # Set the key mapping style to 'emacs' or 'vi'.
zstyle ':omz:editor' keymap 'emacs' zstyle ':omz:module:editor' keymap 'emacs'
# Auto convert .... to ../.. # Auto convert .... to ../..
zstyle ':omz:editor' dot-expansion 'no' zstyle ':omz:module:editor' dot-expansion 'no'
# Set case-sensitivity for completion, history lookup, etc. # Set case-sensitivity for completion, history lookup, etc.
zstyle ':omz:*:*' case-sensitive 'no' zstyle ':omz:*:*' case-sensitive 'no'

View file

@ -25,7 +25,7 @@ function prompt_sorin_setup {
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_sorin_precmd add-zsh-hook precmd prompt_sorin_precmd
zstyle ':omz:editor' completing '%B%F{red}...%f%b' zstyle ':omz:module:editor' completing '%B%F{red}...%f%b'
zstyle ':omz:prompt:vi' insert '' zstyle ':omz:prompt:vi' insert ''
zstyle ':omz:prompt:vi' command ' %F{yellow}%f%B%F{red}%f%b%F{red}%f' zstyle ':omz:prompt:vi' command ' %F{yellow}%f%B%F{red}%f%b%F{red}%f'
zstyle ':omz:module:git:prompt' action ':%%B%F{yellow}%s%f%%b' zstyle ':omz:module:git:prompt' action ':%%B%F{yellow}%s%f%%b'