ATAC
ATAC copied to clipboard
Vim Motions
Is it planned to have Vim motions in general navigation and editing?
Hello!
Yes it is part of the things planned for after v1.0.0 (which will come out soon).
Something I was wondering since I am not a vim user, do you mean "command-like" bindings e.g. :wq
, or just the basic key binding?
Hi!
I was first thinking about vim motions like hjkl
as arrow keys to move arround, even to replace TAB
as moving. Maybe have something like vim mode as INSERT
to edit the url and then come back to NORMAL
so you can keep moving.
Command-like bindings sounds good too but I can't think right now how it could do usefull things.
I would love to see this too. I use Vim as my primary editor and vim motions feel so natural to me, so I initially had a hard time playing around with atac
.
Ideally you would navigate with hjkl
instead of arrow keys. Whenever you have to delete something, you'd usually add dd
as an input for that. Editing request bodies etc. should also also mimic vim to a reasonable extend. It would be great to enable a workflow where you can use actual vim for editing requests, but to be honest, I haven't looked into the file structure that atac
generates yet, maybe its possible to raw-dog these files with nvim.
A great start would be something like this:
hjkl
instead of arrow keys
dd
to delete stuff
CTRL + D or CTRL + U
to navigate up/down a bunch
/
to search for stuff.
I think lazygit
has a good implementation, btm
also comes to mind.
Ideally you would navigate with
hjkl
instead of arrow keys. Whenever you have to delete something, you'd usually adddd
as an input for that. Editing request bodies etc. should also also mimic vim to a reasonable extend. It would be great to enable a workflow where you can use actual vim for editing requests, but to be honest, I haven't looked into the file structure thatatac
generates yet, maybe its possible to raw-dog these files with nvim.A great start would be something like this:
hjkl
instead of arrow keysdd
to delete stuffCTRL + D or CTRL + U
to navigate up/down a bunch/
to search for stuff.I think
lazygit
has a good implementation,btm
also comes to mind.
I am currently working on it in https://github.com/Julien-cpsn/ATAC/tree/10-vim-motions.
The implemenation will be simple at first. And I will try to make the full bindings implemenation on the request body text area so you don't loose your mind :)
Thats great! I'll happily test that feature and provide feedback.
Trying to implement the full range of vim motions in the text area might be way too much (unless theres a library for that or something), since theres a lot of more complex motions that vim users frequently rely on (for examlple ci"
, da}
, dap
, caW
), so don't aim too high. It might be better to implement the basics, and enable a workflow where one can use their editor of choice to edit requests. As a vim user I'll always prefer to do the heavy lifting of text editing with my actual configured instance of nvim.
@mzndr the text area lib that I use has an implementation of it https://github.com/rhysd/tui-textarea/blob/main/examples/vim.rs
So I'll try to do something like this
Sounds great! A lot of vim is muscle memory, so its always hard to tell whats missing before you actually use it. But lets be honest, even basic vim motions would be a huge improvement for vim users, and its really great that you're working on it. Love to see it!
@mzndr @brandon1024 @diego-rapoport @ndtoan96 @greyblake @kayuxx Hello guys!
I have been working on the configurable key-bindings and Vim implementation for the last 20 hours (no joke) Since it reworks most the application's key and event systems, I would like some people to test it before pushing it into prod.
All the code is here: https://github.com/Julien-cpsn/ATAC/tree/10-vim-motions
You can pull it. At first you will see that almost nothing has changed.
If you want to enable the "Vim config" you have to set the ATAC_KEY_BINDINGS
env variable to a key-bindings config file. Luckily I made one for Vim users in key_bindings_templates/vim_key_bindings.toml
. I am not a vim user so it may not be perfect.
You can have it here https://github.com/Julien-cpsn/ATAC/blob/10-vim-motions/key_bindings_templates%2Fvim_key_bindings.toml
The Vim shortcuts are almost fully implemented when editing the request body
If you struggle finding keys etc, you can press Ctrl-h
(or Shift-h
with the Vim config) from anywhere to display the key-bindings help
Also, if you have any question, do not hesitate
Enjoy!
@kayuxx is your backspace problem resolved? (when editing the URL)
Hey @Julien-cpsn!! Thanks for your time and work for this feature. I know that many devs who works directly on the terminal would love some vim keybindings. I tested a bit and the side panel with the collections are very good just as editing the body request. Just what I expected. Haven't tried the cookies part but the keybindings seems good either.
Still getting used to it, but most of default keybinds were already good like u
for editing the URL. a
to change auth and t
for tab. Also no need to delete with the x
key on the URL, but move around with Ctrl h
and Ctrl l
is very helpfull.
I could think of another good key: ciw
as change inside word
I had some difficulties trying to edit the value of params.
If you want me to test some other things I'd be very glad to help!
Thanks for your precious feedback!
I did some changes regarding what @ndtoan96 said here https://github.com/Julien-cpsn/ATAC/pull/44/files and my personnal thoughts. You can pull the branch to get those updates!
Here are the updates:
- delete_forward was x and is now Backspace
- added alt_move_cursor for generic navigation (the k j inputs were never received as a reel char input while creating a request, because it was used for selecting a collection):
# Used when the base keys are not available (Selecting collection while creating a new request)
# Might not happen when using the default config
alt_move_cursor_up = "Ctrl-k"
alt_move_cursor_down = "Ctrl-j"
alt_move_cursor_left = "Ctrl-h"
alt_move_cursor_right = "Ctrl-l"
Still getting used to it, but most of default keybinds were already good like
u
for editing the URL.a
to change auth andt
for tab. Also no need to delete with thex
key on the URL, but move around withCtrl h
andCtrl l
is very helpfull.
The x key has been fixed!
I could think of another good key:
ciw
as change inside word I had some difficulties trying to edit the value of params.
Actually, the c key came from cw
but it's really not that practical, and I cannot implement multi-key combinations such as ciw or cw. So choose another :)) (temporarily set to Enter)
If you want me to test some other things I'd be very glad to help!
I am begging you to do so 😆
This would be a natural UX enhancement as TUI apps (like LazyGit) already have some sort of vim navigations at least. Not necessarily related, I made a floating term client for ATAC inside neovim, so hopefully the vim motions inside ATAC + nvim plugin will make a fairly comfortable combo.
This would be a natural UX enhancement as TUI apps (like LazyGit) already have some sort of vim navigations at least.
Read 3 messages before this one in order to test it out hahah. I wrote down the procedure https://github.com/Julien-cpsn/ATAC/issues/10#issuecomment-2068160911
Not necessarily related, I made a floating term client for ATAC inside neovim, so hopefully the vim motions inside ATAC + nvim plugin will make a fairly comfortable combo.
Very good! Can I put it in my readme ?
Very good! Can I put it in my readme ?
Of course! 🚀
Read 3 messages before this one in order to test it out hahah. I wrote down the procedure
In this matter, I made the copy as curl
feature in my fork, i don't know if you want the PR to go straight to main branch or create with vim-motions branch as target. Please LMK !
@NachoNievaG very great! Main branch is great
@Julien-cpsn Yeah, it works. I just checked the keybindings and it was mapped to x
instead of Backspace
, so I remapped it and it works fine. Thank you for the feature!
@kayuxx is it ready for production you think?
Btw you can pull the branch to get some updates
@Julien-cpsn Yes, I think it's ready to be used. It just has one thing to do. It would be great to implement these Vim keybindings #44.