mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
19 lines
378 B
Bash
19 lines
378 B
Bash
# Bind quick stuff to enter!
|
|
#
|
|
# Pressing enter in a git directory runs `git status`
|
|
# in other directories `ls`
|
|
magic-enter () {
|
|
if [[ -z $BUFFER ]]; then
|
|
echo ""
|
|
if git rev-parse --is-inside-work-tree &>/dev/null; then
|
|
git status -u .
|
|
else
|
|
ls -lh
|
|
fi
|
|
zle redisplay
|
|
else
|
|
zle accept-line
|
|
fi
|
|
}
|
|
zle -N magic-enter
|
|
bindkey "^M" magic-enter
|