vscode-helix icon indicating copy to clipboard operation
vscode-helix copied to clipboard

Save?

Open A1igator opened this issue 1 year ago • 3 comments

Hi,

Why is there no :w to be able to save?

Thanks, Ali

A1igator avatar Mar 21 '24 17:03 A1igator

I suspect this is because commands in general aren't implemented yet.

Einliterflasche avatar Mar 30 '24 16:03 Einliterflasche

Hey yes I've been busy as of late, i manage other VS Code extensions and maintain a JS engine plus a full time job so this has fallen a bit in priority. I'm happy to help you add this feature if you want to have a go, it should be straight forward to be honest.

Lets look at how search works (because command mode will be similar) Typing / puts us into search mode, see here: https://github.com/jasonwilliams/vscode-helix/blob/ad779c6282ae3e96a81c9f5723ea41ea831527d7/src/actions/actions.ts#L79-L81

Every key stroke goes to the type handler, but because we're in search mode you can see it goes down a different path (it calls addChar and returns) https://github.com/jasonwilliams/vscode-helix/blob/ad779c6282ae3e96a81c9f5723ea41ea831527d7/src/type_handler.ts#L9-L11

addChar is handled by the search class https://github.com/jasonwilliams/vscode-helix/blob/main/src/search.ts#L45-L64

So, we already have a commandLine class which is a bit bare at the moment. You could do something similar. When someone types : you could enter commandLine mode (which would be added here), then have characters added, then on enter check what command has been ran. If w has been ran you can call the vscode command https://code.visualstudio.com/api/references/vscode-api#workspace (save)

jasonwilliams avatar Mar 31 '24 16:03 jasonwilliams

Hi, sorry I did not mean to come off as unappreciative of your work. It's a great extension! I was curious if it was a design decision or something. Thanks for the directions! I'll try and work on it if I have time.

Thanks for all your work again!

A1igator avatar Apr 01 '24 05:04 A1igator