darrenburns/posting

Add support form vim style key bindings

kylemhall opened this issue · 7 comments

It would be really great to have support for vim-style key bindings!

I assume you mean in the request body editor? 😄

Let me know which keys in particular you would like.

That is correct!

I grabbed this bit from https://www.freecodecamp.org/news/vim-key-bindings-reference/
I think most of these could be added without too much fuss. I imagine things like insert vs visual mode might be more difficult.

Moving to Top and Bottom

You can use these keys to move to the top or bottom of the page:

gg --> Move to the first line of the page
G --> Move to the last line of the page
How to Edit Text in Normal Mode
Deletion and Copying

You can delete or copy characters using these keys:

x --> Delete the character under the cursor
dd --> Delete the entire line
yy --> Copy (yank) the entire line
p --> Paste the previously deleted or copied text after the cursor

Undo and Redo

u --> Undo the last action
Ctrl + r --> Redo the undone action

Thanks!

These binds would require the addition of an insert mode though. Quite a few Vim bindings already work in the response area since that's read only. However, I would need to add a mode system in order to support the ones you've listed in the request area.

Possibly in the future I'll look at this, but for now you can easily edit the request in Vim by pressing f4 (assuming you have your EDITOR env var set).

Excellent, thanks for that tip!

It would be great to move 10 lines up/down by pressing ctr+u/ctrl+d in the response widget (json), just like vim.

I've added ctrl+d and ctrl+u in 1.2.0.

IMHO, due request body is read-only, I think other keybindings for edit shouldn't be included, for editing you can just open the editor. Said that, and the fact that basic movements are already implemented, this issue could be mark as done (?)