1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-17 13:31:13 +00:00

Simplify a few for loops

This commit is contained in:
Sorin Ionescu 2012-04-08 18:37:22 -04:00
parent a7db355e26
commit dc7c51434a
3 changed files with 9 additions and 18 deletions

View File

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

View File

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

View File

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