mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Added magic-enter plugin
To bind commonly used tasks to the enter key
This commit is contained in:
parent
599831b85a
commit
36f1835953
2 changed files with 24 additions and 0 deletions
5
plugins/magic-enter/Readme.md
Normal file
5
plugins/magic-enter/Readme.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## Magic Enter
|
||||
|
||||
**Maintainer:** [@dufferzafar](https://github.com/dufferzafar)
|
||||
|
||||
Makes your enter key magical, by binding commonly used commands to it.
|
||||
19
plugins/magic-enter/magic-enter.plugin.zsh
Normal file
19
plugins/magic-enter/magic-enter.plugin.zsh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue