Julien-cpsn / ATAC

A simple API client (postman like) in your terminal
https://atac.julien-cpsn.com/
MIT License
1.83k stars 78 forks source link

Feature Request: Support for different modes for vim bindings #72

Open guruor opened 4 months ago

guruor commented 4 months ago

Being a vim user I was using rest.nvim, it covers my day to day usage except for few cases like file upload. So was always looking for a lightweight alternative of Postman. Thank you so much for a lightweight client.

I tried using the vim bindings provided in the repo, it unfortunately didn't work as expected, it usually causes conflicts when editing values. For example the default binding used to display help is H, Now when editing the URL, if I were to type variable name HOST, I am not able to do so because the moment I type H it opens up the help menu.

https://github.com/Julien-cpsn/ATAC/assets/14184045/65ed524b-1feb-45b3-80c7-41649ecd5743

As a workaround I can remap the help binding but that would cause conflict with some other key which I will need to remap.

So I am suggesting to implement vim modes like NORMAL and INSERT, where in INSERT mode no keys will trigger the binding action and ESC key can change the mode back to NORMAL. Similar implementation can be found in this terminal file manager yazi

Sample clip from their demo:

https://github.com/Julien-cpsn/ATAC/assets/14184045/941253bb-511d-4d1c-9927-795fad6aa9f6

OR

We can add an option to open the content in preferred editor using $EDITOR where user can edit the content and edited content can be conveyed back to ATAC, this will provide more flexibility and user can utilise the syntax highlighting of the editor as well.

guruor commented 4 months ago

After testing for a while I could see that for body textarea we have vim emulation available, but it is not available for input boxes. I could find the input component in yazi source: yazi-core/src/input We can utilise this components.

Julien-cpsn commented 4 months ago

Hello @G0V1NDS

thanks for your issue and your investment on the project

The big problem with the text area is that it remains unmaintained and is plainfull to use. Concerning the main issue you are talking about, I personnally think that it would a great thing the improve the vim config file. Since it works great with most use case.

If you have any more ideas, tell me

Have a great day

ficolas2 commented 1 month ago

Have you considered maybe using a vim library, or communicating with nvim? Something like this which is a vim fork, to be ran as a backend https://github.com/onivim/libvim Or a rpc client, that uses the nvim api https://github.com/KillTheMule/nvim-rs

Implementing a vim emulation for every software we want to add vim motions to doesn't seem very practical, and there seem to be good alternatives out there.