Zimilar

This small gem extends your zsh to autocorrect inputs that would led in a 'command not found'. It basically looks into your history file and tries to match the most suitable command found.

There is no reason why this should only work with zsh, but I haven't tested it with other shells yet and there is currently no logic in zimilar that tries to find out your current running shell.

zimilar is just a small late-night hack I did and might be improved in the future. Its code is currently also not that optimized but for now, it works.

I also think that it might be better to write this as a native shell function in order to not require ruby to be installed. As times pass by, this might change.

Installation

Install it yourself as:

$ gem install zimilar

Install from source:

$ git clone https://github.com/lotherk/zimilar.git
$ cd zimilar
$ rake build
$ gem install pkg/zimilar-VERSION.gem

Or simply copy the bin/zimilar to anywhere you want. Please ensure to install its dependencies.

Usage

Add the following into your .zshrc or any other file that is being sourceed during your login:

function command_not_found_handler() {
  zimilar $@
}

Example:

kl@kbook:~/ $ vm
Auto-guessed 'vim', 60.0%
kl@kbook:~/ $

Contributing

  1. Fork it ( http://github.com//zimilar/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request