asm-editor icon indicating copy to clipboard operation
asm-editor copied to clipboard

Vim mode

Open rajayonin opened this issue 2 months ago • 4 comments

Adresses #35.

Ok, I had to do a bit of hacky stuff... but it works.

One thing is the vim status bar... I don't know enough CSS or Svelte (or HTML for that matter) to put it in a nice place and color it and stuff, so it looks like this: vim mode

Ideally, the status bar would appear on the top or the bottom of the editor. Compiler Explorer puts it at the top: image

rajayonin avatar Oct 16 '25 20:10 rajayonin

I also would like to add the custom keybinds. Just for reference, in my project I did the UI like this: image

rajayonin avatar Oct 16 '25 21:10 rajayonin

There is a floating setting for standard keybinds, you could add it there.

I haven't used vim, what are these custom keybinds useful for?

Specy avatar Oct 16 '25 21:10 Specy

I haven't used vim, what are these custom keybinds useful for?

Let me start by stating that the people that use Vim (me, for example) are typically people who want to optimize everything as much as possible, and that includes creating custom keybindings for faster actions.

Let me give you a quite common example. Vim is a "modal" editor, which means that you have different modes where your key presses mean different things (the current mode is shown in the statusbar, that's why it's important to have it). In NORMAL mode, typing dd deletes the current line, while in INSERT mode each key inserts the character, as in any other editor. Now, to go from NORMAL mode to INSERT mode you type i, and to go back to NORMAL mode you press Esc. But moving your hand all the way up to the Esc key is too much work for us Vim users, so many of us remap jk (or kj) to Esc.

The thing is, you get so used to this that if you don't have these custom keybindings in a Vim editor, you feel VERY weird. You can always run a command to quickly remap this (:imap kj <Esc>, I've tested it and it works on the plugin), but doing this every time is a bit tedious and it would be better to store it as local configuration, which is similar to the way it's actually done in Vim by editing the config file (.vimrc). It be extra cool to allow users to upload their .vimrc, parse it in a quick and dirty way, and automatically load their keybindings, but that may be too much.

Compiler explorer doesn't allow you to do any of this, btw.

And offtopic, I think every developer should learn at least a bit of Vim, it comes installed in every Linux distro and is useful for quickly editing config files in servers.

rajayonin avatar Oct 16 '25 21:10 rajayonin

Yes I know vim and use it sometimes mostly when I'm configuring things via SSH, but didn't know about what keybinds could be useful for, thanks for explaining!

You can add it in the keybinds for shortcuts settings panel here: https://github.com/Specy/asm-editor/blob/main/src/components/specific/project/settings/ShortcutEditor.svelte The UI should be below the keybinds one.

You don't have to make it pretty, I can do that after we merge the PR

Specy avatar Oct 17 '25 06:10 Specy