kisielk / vigo

Vi in Go
Other
168 stars 17 forks source link

Shortest unique string matching for command mode #29

Open kisielk opened 10 years ago

yarbelk commented 10 years ago

I started looking into this (and had a hard drive failure: so I'm starting again). Part of this to me means redoing the command switch (mode/normal.go) as a map.

This allows us to separate out an interface for things like movements, etc, and do some more functional things on these sets

It also lets us configure the keybindings and do something like. and seperate out the keystroke into a structure. This lets us do interesting things with the key bindings to get robust shortest unique strings and composed commands.

http://en.wikipedia.org/wiki/De_Bruijn_graph

There are some older algos that are simple to implement (did some playing with them for some gene sequencing work) and would possibly give us a fast and robust method of composing commands in various modes.

yarbelk commented 10 years ago

plus - the switch makes me twitch.

yarbelk commented 10 years ago

Also, that algorithm is a joke. Huffman would probably work better/easier.

kisielk commented 10 years ago

Interesting, I hadn't heard of De Brujin Graphs, I'll have to read up on it.

I was thinking of using a radix tree as the data structure for commands, but this sounds interesting.

yarbelk commented 10 years ago

radix tree or huffman encoding would be significantly more sane than De Brujin Graphs

yarbelk commented 10 years ago

ack. started reading the ed source code... ed