diff --git a/bash-zsh_TerminalShorcuts.md b/bash-zsh_TerminalShorcuts.md index 8b298d5..a2176cd 100644 --- a/bash-zsh_TerminalShorcuts.md +++ b/bash-zsh_TerminalShorcuts.md @@ -44,6 +44,33 @@ Last command is: - **bash:** `bind -lp` - **zsh:** `bindkey -L` +# Custom shortcuts +## Iterate through the arguments in a previous command +*only works in zsh, and probably only Linux* + +run or add this to your `~/.zshrc` + + autoload -Uz copy-earlier-word + zle -N copy-earlier-word + bindkey "^[:" copy-earlier-word + +Now use Alt+. to go as back as you want, then use Alt+: to iterate through the arguments + +### Example: +Last command is + + echo 1 2 3 4 5 + +- Alt+.: `5` +- Alt+.+:: `4` +- Alt+.+:+:: `3` +- Alt+.+:+:+:: `2` +- Alt+.+:+:+:+:: `1` +- Alt+.+:+:+:+:+:: `echo` + +source: https://stackoverflow.com/a/34861762/3163120 + + # Other examples ## Common usecases