Hacker News new | ask | show | jobs
by alpaca128 927 days ago
I am currently working on an editor. Definitely interesting to try different ideas just to find out why certain things in Vim are that way. Also the "." key is more complicated than I expected, the exact start of an edit operation depends on the behaviour of certain default keybindings. It just works so smoothly I had never thought much about it before.

> Maybe one of these days I will get far enough past the ADHD wall to make it happen...

That's definitely the most difficult part, for me it got easier at some point once it actually seemed realistic that I'd manage to finish it one day.

1 comments

The coolest feature of Vim is its macros. They bring the entire UX into one cohesive feature. The keymap has meaning, because every key symbol is a character, and a macro is just a string. You can paste them, edit them, copy them, then play them back; all without ever leaving Vim's primary UX. Macros are stories written, not in vimscript, but in the language of Vim itself.

Macros are also the reason I don't use Vim anymore. The keymap has meaning, and it shouldn't. Want to change your keymap? Good luck.

I spent years in Vim. I conceptualized all of it. I built my muscle memory around it. Then I learned a new keyboard layout.

I tried remapping the keys. Not only was that impossible (circular dependencies), it broke the conceptual map, too. I have offended the beast, and am welcome no more.

What I really want is to start fresh. No defaults: just user config. Give me the pieces, and the glue to hold them together: I'll do the rest.

>Macros are stories written, not in vimscript, but in the language of Vim itself.

Last year I hit upon the idea that vim's commands are like a bytecode that my brain outputs and vim interprets. I guess that's true of any editor UI, but it just feels more appropriate in the vi case.

I had different reasons but I only hardcoded a few basic keybindings like Escape. Everything else is customizable, but still limited to the three modes (it's just a good combination). Defining explicit keybindings for every symbol on the keyboard turned out to be the cleanest way to fix bugs in the input handler, special behaviour just for insert mode isn't worth it.

> I tried remapping the keys. Not only was that impossible (circular dependencies)

I wonder if that could be remapped in the code itself? From a quick look they seem to be defined in ops.c and vim.h, but I'm not very familiar with the codebase.

> I tried remapping the keys. Not only was that impossible (circular dependencies)

I don't get this. To swap x and y is easy:

  noremap x y
  noremap y x
Of course you can't do it with map, that's why noremap exists.
Believe me, I have tried. It's been a while, or I would tell you precisely what went wrong. Suffice it to say, I did not give up easily.

Even if it did work, I wouldn't have the conceptual map that Vim's UX is made of. Without that, it's just not going to be a positive experience.