Hacker News new | ask | show | jobs
by mfontani 2306 days ago
Vim's power doesn't come from using single-letter commands to do things but, rather, in the language-like (action, verb, noun) expressions the whole ecosystem enables: "daw" to delete a word, "cit" to replace the "inner" part of a tag and start typing, numbered prefixes to execute an action that number of times, etc.

See also: https://stackoverflow.com/questions/1218390/what-is-your-mos... aka "Your problem with Vim is that you don't grok vi."

3 comments

OP here. I completely agree with that. The goal of ModalEdit is not to emulate those verb-noun commands. VS Code's commands operate on selections, so it is very cumbersome to turn them to work in Vim way. Instead, you should try to mimick something like [Kakoune][1] which is another modal editor that uses the selection as command target.

I'm sure ModalEdit doesn't tempt any hardcore Vim users to use VS Code. But there are a lot of VS Code user's who have used Vim and like idea of modal editing. Having an extension that you can configure from ground up is the value proposition I was aiming for; not to make a poor man's Vim clone.

[1]: https://kakoune.org/why-kakoune/why-kakoune.html

Well, this certainly looks interesting. You mean I could use ModalEdit as a basis to bringing Kakoune like selection behaviour to VS Code as long as I'm willing to configure it? I have played with Kak, but Code's extensions are easier to use and more powerful still. I so very much would like to get the best of both.

Have you used Kakoune yourself? Is there something that's currently not feasible with VS Code using ModalEdit? I'm still going through ModalEdit docs to get an idea of what's possible.

Also, Literate Configuration is a good idea. I don't suppose there's a Jupyter notebook like editor available where markdown and code parts can be seen alongside in fully rendered form?

I have to admit that I haven't used Kakoune myself. I just like its approach of taking the good parts of Vim and adapting them to more "mainstream" style of editing.

Because Kakoune's editing operations are much closer to VS Code than Vim's, I think you can copy its functionality quite extensively with ModalEdit. The only limitation is that VS Code itself needs to have the commands to support these operations. The configuration involves just binding key sequences to the commands. However, VS Code marketplace has so many command extensions, so I bet you can find substitutes for most Kakoune features there.

Regarding the literate configuration, there is no Jupyter-style online editor for it, afaik. I use (of course) VS Code to edit my `settings.json` file. In the background I run [LiTScript][1] in watch mode to generate the documentation on the fly. I also use the [Live Server][2] extension to automatically reload the generated documentation when it has been changed. With this setup, saving the `settings.json` file causes VS Code to reload the configuration, LiTScript to generate the updated documentation, and Live Server to reload it automatically. So, it is almost like Jupyter in the sense that you see your changes in effect immediately.

[1]: https://johtela.github.io/litscript/ [2]: https://marketplace.visualstudio.com/items?itemName=ritwickd...

Thank you. I'll be sure to check ModalEdit. Since VS Code is so easy to extend I guess I'll just have to find what things to copy over from Kak. Since Kak can be used as a server also (https://github.com/mawww/kakoune/wiki/JSON-RPC) I can send stuff over to it for more extensive editing.

I'll check the LitScript also. Yours sounds like quite a workable workflow.

“Dance” is a VSCode extension that provides Kakoune inspired key bindings. I have tried it but have never seriously used it. Will give ModalEdit a try.

https://marketplace.visualstudio.com/items?itemName=gregoire...

Thanks. There's also https://github.com/reykjalin/kakoune-mode which sends input from VS Code to Kakoune and shows its output back within Code. I haven't tested it yet, though.
And then you start recording those expressions into macros just by pressing q. Or just repeat the last one with a period. Vim is so great in so many ways, I always have to use a Vim emulation layer when using Visual Studio.
One of the best resources that I have used (in the distant past) is vim golf[1]. It's a super fun way to level up your vim skills.

[1] https://www.vimgolf.com/

The issue I always had with it is that you can’t see the really good answers (unless that’s changed). I wanted to push an “I give up” button so I could access answers that would help me learn.
That was always the best part of ProjectEuler was seeing everyone else’s answers after solving the problem.