Browse Source

Simplify a few for loops

master
Sorin Ionescu 13 years ago
parent
commit
dc7c51434a
  1. 8
      init.zsh
  2. 5
      modules/directory/init.zsh
  3. 14
      modules/editor/init.zsh

8
init.zsh

@ -21,16 +21,12 @@ fi @@ -21,16 +21,12 @@ fi
# Load Zsh modules.
zstyle -a ':omz:load' zmodule 'zmodules'
for zmodule in "$zmodules[@]"; do
zmodload "zsh/${(z)zmodule}"
done
for zmodule ("$zmodules[@]") zmodload "zsh/${(z)zmodule}"
unset zmodule{s,}
# Autoload Zsh functions.
zstyle -a ':omz:load' zfunction 'zfunctions'
for zfunction in "$zfunctions[@]"; do
autoload -Uz "$zfunction"
done
for zfunction ("$zfunctions[@]") autoload -Uz "$zfunction"
unset zfunction{s,}
# Source files (the order matters).

5
modules/directory/init.zsh

@ -19,8 +19,5 @@ unsetopt CLOBBER # Don't overwrite existing files with > and >>. @@ -19,8 +19,5 @@ unsetopt CLOBBER # Don't overwrite existing files with > and >>.
# Use >! and >>! to bypass.
# Aliases
for index in {1..9}; do
alias "$index"="cd +${index}"
done
unset index
for index ({1..9}) alias "$index"="cd +${index}"; unset index

14
modules/editor/init.zsh

@ -116,15 +116,13 @@ zle -N prepend-sudo @@ -116,15 +116,13 @@ zle -N prepend-sudo
bindkey -d
# Emacs key bindings.
for key in "$keyinfo[Escape]"{B,b}; \
bindkey -M emacs "$key" emacs-backward-word
for key in "$keyinfo[Escape]"{F,f}; \
bindkey -M emacs "$key" emacs-forward-word
for key ("$keyinfo[Escape]"{B,b}) bindkey -M emacs "$key" emacs-backward-word
for key ("$keyinfo[Escape]"{F,f}) bindkey -M emacs "$key" emacs-forward-word
bindkey -M emacs "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word
bindkey -M emacs "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word
# Kill to the beginning of the line.
for key in "$keyinfo[Escape]"{K,k}; \
for key in "$keyinfo[Escape]"{K,k}
bindkey -M emacs "$key" backward-kill-line
# Redo.
@ -186,15 +184,15 @@ for keymap in 'emacs' 'viins'; do @@ -186,15 +184,15 @@ for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "$keyinfo[Control]L" clear-screen
# Expand command name to full path.
for key in "$keyinfo[Escape]"{E,e}; \
for key in "$keyinfo[Escape]"{E,e}
bindkey -M "$keymap" "$key" expand-cmd-path
# Duplicate the previous word.
for key in "$keyinfo[Escape]"{M,m}; \
for key in "$keyinfo[Escape]"{M,m}
bindkey -M "$keymap" "$key" copy-prev-shell-word
# Use a more flexible push-line.
for key in "$keyinfo[Control]Q" "$keyinfo[Escape]"{q,Q}; \
for key in "$keyinfo[Control]Q" "$keyinfo[Escape]"{q,Q}
bindkey -M "$keymap" "$key" push-line-or-edit
# Bind Shift + Tab to go to the previous menu item.

Loading…
Cancel
Save