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

Vim/Emacs support

Open rajayonin opened this issue 2 months ago • 5 comments

It would be cool to add support for Vim (and Emacs, I suppose) keybindings, as there are a couple of plugins that (supposedly) do all the work: monaco-vim and monaco-emacs.

I could try to hack something together when I find some spare time, but I can't promise anything...

rajayonin avatar Oct 16 '25 19:10 rajayonin

What kind of keybinds would you be using for the editor?

Specy avatar Oct 16 '25 19:10 Specy

The Emacs one that you linked seems to not be active, the vim one is. You could add that one. I don't think it should be that difficult to include if you want to try it yourself

Specy avatar Oct 16 '25 19:10 Specy

What kind of keybinds would you be using for the editor?

I mean a full on "Vim mode", with all the regular Vim keybindings, like in Compiler Explorer when you click the "Vim" button. It would also be cool to allow the users to specify their own custom keybinds (e.g. remap kj to <Esc> in insert mode). This seems to be supported by the plugin.

The thing is, I've already implemented this in another project, but that used Vue.js and Codemirror.

rajayonin avatar Oct 16 '25 19:10 rajayonin

Yeah it could be a good addition, there is a setting store that automatically implements itself as long as you define the correct configuration, you can see the implementation for checkboxes I have already.

Then you have to change the editor to have a new optional parameter "vimMode" that it then uses internally to decide to enable vim mode or not

Specy avatar Oct 16 '25 20:10 Specy

Look here:

  • https://github.com/Specy/asm-editor/blob/main/src/stores/settingsStore.svelte.ts
  • https://github.com/Specy/asm-editor/blob/main/src/components/specific/project/Editor.svelte
  • https://github.com/Specy/asm-editor/blob/main/src/lib/monaco/Monaco.ts

Remember to increase the settings version number every time you edit the settings as it's in local storage and will be stale otherwise

Specy avatar Oct 16 '25 20:10 Specy