VER – Vim & Emacs in Ruby

Description

VER is a “text editor” in the tradition of Emacs, providing a whole environment around your editing experience. It also borrows heavily from Vim, most prominently modal editing and the default keyboard map. Finally, I also have to thank the TextMate developers and community, because we are standing on their shoulders by reusing the syntax definitions and completion routines as long as they are under an acceptable license (no code of TM is used).

At the time of writing, around 140 different languages have syntax highlighting and around 130 languages have extended capabilities like completion or automatic indentation.

Dependencies

  • You will need to install tk if it isn’t on your system already. Detailed installation instructions for all major platforms and more information about Tcl/Tk are available at: Tcl/Tk Project
  • In an attempt to make VER available for all Ruby implementations, I wrote an alternative for ruby-tk, called ffi-tk. Eventually it should be available as a gem, but for now you can get the source from manveru/ffi-tk on github No compilation required.

Features

  • VER and ffi-tk are 100% (hopefully straightforward) Ruby.
  • Syntax highlighting for around 140 file types.
  • Keymaps for Vim, Emacs, Nano, and Diakonos behaviour.
  • Intelligent indentation based on file type.
  • Automatic completion for words, lines, aspell, and more.
  • Support for TextMate bundles and snippets.
  • Recursive fuzzy file finding
  • Recusive pattern grepping
  • Find and replace using oniguruma
  • Unlimited undo
  • In-buffer ruby evaluation, can also be used for text manipulation
  • CTags support
  • much more…

Installation

For Tcl/Tk there are various instructions available from Tk Docs

VER only runs on Ruby 1.9.1+, but should run on any implementation conforming to the corresponding specification because no C extensions are involved. At the time of writing, VER should run on MRI and JRuby (with —1.9 switch). This means that there is no need to follow all the complicated instructions to get Ruby and Tk to work together, you do need to install both however.

General Information

A couple of hints that should help you get started on any platform. See further below for detailed instructions for specific platforms, feel free to contribute additional information as you encounter issues.

Installing RVM will show you how to install rvm, which is the best way to get Ruby 1.9.1 on platforms that have no package available. Once rvm installed, a simple rvm install 1.9.1 and rvm use 1.9.1 should get you going. Tk is easy to install in most cases, for Windows there is ActiveTcl, and there are packages for every linux distribution i know.

OSX poses a unique challenge, it does ship with Tk 8.4there on one hand TkAqua, which uses the old Carbon UI, and on the other hand X11/Tk, which requires X11 to be installed (I hear it’s part of XCode). Users have reported best functionality under X11. Since VER doesn’t use any buttons, sliders, or entry widgets, the difference should be very hard to notice. Additionally, there is a developer working on a Tk-Cocoa port, which should be ready in the near future.

Archlinux

Installation on Archlinux is simple, as Ruby 1.9.1 and Tk 8.5.8 are the default packages (in the extra repository).

pacman -S tk ruby gem install ver

I plan to make a tarball release of VER sometime in the future to allow easy installation from AUR.

Configuration

At the time of writing, there are only a few options exposed. Options can be changed in your ~/.config/ver/rc.rb where you can find a few default settings already. In earlier revisions of VER, options are often to subject change, so be aware that at some point they might not work as expected anymore. If options are deprecated or replaced, I will try to keep the configuration working, but in early stages this is no priority.

Plugins

There is a handful of plugins available right now, which you can use by adding VER.plugin :name statements in your ~/.config/ver/rc.rb file. The most stable ones are probably the git and autosave plugins. So, to use the git plugin, put VER.plugin :git in your rc.rb. Please note that all plugins have only bindings in the vim keymap right now, autosave doesn’t require any keybinds, so it works with all keymaps.

Keymaps

VER features 3 keymaps out of the box, Vim, Nano, and Diakonos, which are constantly tested and improved. As might be expected, the Vim keymap is not 100% complete, and I’m adding new mappings as I become aware of them. Vim is a fairly complex piece of software developed over the past 20 years, so don’t expect full compatibility or behaviour in all cases.

An Emacs keymap is currently under development, but not ready for daily use.

We are searching for contributors that can provide keymaps for other editors. To add a new keymap, put it under config/keymap/$name.rb and start VER with

ver -k $name

Where $name is a placeholder for the filename of the keymap you created. So to try out nano, use ver -k nano.

Yet another editor?

A little bit of philosophy

After many years of being a code ninja, it became apparent to me that there could be as many editors as there are developers.

It feels to me, like there are many useless religious wars going on around this seemingly simple topic, there is the church of emacs, the cult of vi, and many other groups that don’t have chosen how to call themselves yet.

I’m guilty myself of telling people what to use, without really considering what the consequences of my actions are.

A text editor should not be treated like a religion.

For one, everybody should be given an objective overview over the choices out there. Recently, Wikipedia seems to have taken over this role, so I won’t invest much energy into this topic.

What I find really interesting, is that only very few people even think of attempting to write their own editor.

Maybe I’m suffering from a severe case of NIH, but i want to give everybody a chance to see what’s involved. You can write an equivalent of nano in a couple of days, but how much does it take to improve on the concepts of the great editors?

I won’t say it’s an easy task, it’s more in the spirit of a Jedis building their own laser-sword, once you reach a good enough proficiency in programming it should be good practice to build your own tools, and what tool is more to writing programs than an editor?

It also has other benefits, teaching you new things about yourself and the way you work. You will learn more about the strengths and weaknesses your language. The next time you curse your editor, you can make it better.

Background

I’ve used many editors over the years, and a lot of them have inspired me, amongst them are Proton, JEdit, SciTE, Vim, Emacs, Nano, Gobby, GEdit, Kate… However, Vim and Emacs can be considered the most prominent of the editors that try to do much more than just editing text.

I’ve never had a big interest in IDEs, maybe because Ruby saves you from most of the boilerplate that is usually associated with programming, and for most dynamic languages they just don’t provide you that much.

Maybe, someday, VER will become for Ruby what Emacs is for Lisp. I have very mixed feelings about that.

The name

I tried to come up with a short name, that would give credit to my biggest inspirations. There is not much more to it.

Development

VER is free and open software, we welcome anyone to use it and contribute. The source is at “Github”:“http://github.com/manveru/ver”

For bug tracking, release-, and feature-planning, we use “Pivotal Tracker”:“http://www.pivotaltracker.com/projects/61971/overview”. You can join the tracker and help out with creating stories.

Thanks

I’d like to thank following people:

  • Aman Gupta and the folks in #eventmachine Helping me and keeping me going crazy when I hit some weird C syntax.
  • Francis Cianfrocca EventMachine, making evented programming fun and even profitable.
  • Julian Langschaedel First user and contributor.
  • Pistos Inspiration through Diakonos and patience testing just about anything I throw at him.
  • Richard M. Stallman Emacs
  • Yukihiro Matsumoto Ruby, ruby-tk, and the knowledge that programmers can make a deep impact if they are just persistent enough.

License

(The MIT License)

Copyright © 2009 Michael Fellinger

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.