[implementations-list] Early implementation of new VIM-like mode

Frank Fischer frank.fischer at mathematik.tu-chemnitz.de
Wed Jul 1 18:30:14 CEST 2009


Hallo,

the recent development of vimpulse encouraged me to think again about a 
new VIM-mode for Emacs.  I'm one of those who think that implementing a 
new vim-mode from scratch might be easier and more powerful than 
extending viper.

In this post I'd like to present you an early result of my attempts.  
Currently I call is just 'vim-mode', but that name is not important.  
The code is very modular (I hope) and built around an own keymap 
structure.  This means vim-mode does not use the default Emacs-keymaps 
but handles all events within its own data structures.

The handling of keymaps is an independent subsystem.  Commands and 
motions can be defined independently and operators (commands with 
motions, I call them 'complex' commands) can be combined with arbitrary 
motions.  In fact, a motion is just a function returning one or two 
positions in the buffer.

Furthermore, vim-mode supports mapping of commands.  This is a quiet 
powerful feature: many more complicated commands can be defined by 
simple mappings without the need of an own implementation.  For example 
the command "x" is defined

(vim:def-map "x" "dl")

and "O" is defined

(vim:def-map "O" (kbd "0 i RET <up> TAB"))

look at the file 'vim-maps.el' for more examples.  (OK, I'm not sure if 
those definitions are correct in all cases, but they seem to work OK 
for me).

You can find the code at

http://www.tu-chemnitz.de/~fifr/downloads/vim-mode.tgz

and a mercurial repository at

http://www.tu-chemnitz.de/~fifr/repos/vim-mode

Just open the file 'vim.el' and evaluate it.  Don't forget to read the 
comments in 'vim.el'

I hope that this code can convince some of you of this approach in favor 
for extending viper (although vimpulse is really great - I use it every 
day, especially when developing vim-mode ;) - I think vim-mode is worth 
further development and as the potential to be even better than viper + 
vimpulse).

Any comments, suggestions or patches are very welcome.

Greetings,
Frank



More information about the implementations-list mailing list