Skip to content

Make your enter key magical by binding a Zsh command to it

License

Notifications You must be signed in to change notification settings

zshzoo/magic-enter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

magic-enter

License built for works with prezto

Make your enter key magical by binding a Zsh command to it

Description

Based on magic-enter.

Customization

You can define your own magic-enter commands using the following zstyles.

zstyle -s ':zshzoo:magic-enter' command 'ls -laFh .'
zstyle -s ':zshzoo:magic-enter' git-command 'git status -sb .'

You can also define your own magic-enter-cmd function. Whatever it prints is what will be run when no other command is given. You can use this if you want to extend the command beyond just looking for a git repo.

function magic-enter-cmd {
  if [[ -n "$$VIRTUAL_ENV" ]]; then
    echo "python3 --version"
  else
    echo "ls -laFh ."
  fi
}

Installation

Install with a Zsh plugin manager

To install using a Zsh plugin manager, add the following to your .zshrc

  • antidote: antidote bundle zshzoo/magic-enter
  • zcomet: zcomet load zshzoo/magic-enter
  • zgenom: zgenom load zshzoo/magic-enter
  • znap: znap source zshzoo/magic-enter

Install manually, without a plugin manager

To install manually, first clone the repo:

git clone https://github.com/zshzoo/magic-enter ${ZDOTDIR:-~}/.zplugins/magic-enter

Then, in your .zshrc, add the following line:

source ${ZDOTDIR:-~}/.zplugins/magic-enter/magic-enter.zsh

Prezto Install

To install with Prezto, first clone the repo from an interactive Zsh session:

# make sure your $ZPREZTODIR is set
ZPREZTODIR=${ZPREZTODIR:-~/.zprezto}
# clone the repo to a prezto contrib dir
git clone https://github.com/zshzoo/magic-enter $ZPREZTODIR/contrib/magic-enter/external
# set up the contrib
echo "source \${0:A:h}/external/magic-enter.plugin.zsh" > $ZPREZTODIR/contrib/magic-enter/init.zsh

Then, add the plugin to your Prezto plugins list in .zpreztorc

zstyle ':prezto:load' pmodule \
  ... \
  magic-enter \
  ...

About

Make your enter key magical by binding a Zsh command to it

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages