vim-docker-tools icon indicating copy to clipboard operation
vim-docker-tools copied to clipboard

Proposal for alternative key mappings

Open vlcinsky opened this issue 6 years ago • 1 comments

I am aware that usability can become never ending story. Anyway, as I feel the vim-docker-tools is hitting the need of couple of users, here is my humble contribution to that topic:

Consider changing key mapping in status buffer as follows:

# ------------------------------------------------------------------------------
# s: start container
# d=>S: stop container
# r=>R: restart container
# x=>d: delete container
# p=>-: pause container
# u=>-: unpause container
# >=>!: execute command to container
# <=><CR>: show container logs
# a: toggle show all/running containers
#  =>r: reload status
# =>q: close status (this window)
# ?: toggle help
# ------------------------------------------------------------------------------

Reasoning:

My proposal is heavily inspired by Fugitive key mapping which is very popular and many users are likely to have these keys already in muscle memory.

start/stop (s/S)

Uppercase often means the opposite, resp. the uppercase is often more difficult to enter so it is used for more dangerous actions.

delete (d)

While x is standard vim "delete", it aims at character level. As one image is represented by a line, d seems more intuitive.

restart image (R)

not using r to reserve r for "refresh status" (for more see later).

R includes stop, so it is consistent with the "shift" being present in "S"top.

pause/unpause (-/-)

This assumes that it is easy to ensure "toggle" behaviour with pause/unpause.

It follows the "add/remove" logic at Fugitve.

The "-" is mnemonic to pause symbol on players and behaves the same style.

Execute command in container (!)

! is common in vim for executing something.

Personally I have difficulties to think, which of > and < are for execution and which for logs. ! is easy to remember.

Show container logs (<CR>)

<CR> is often used to "open the file". Log represents the running image (and has an advantage there is up to one log per image).

Reload status (r)

Following the Fugitive style.

Close status (q)

q makes :DockerToolsClose so simple to call.

vlcinsky avatar Jul 30 '18 15:07 vlcinsky

Thanks for the suggestion! Some of the key bindings are really good(e.g. ! for command execution) and I will consider adopting some of them.

kkvh avatar Jul 31 '18 01:07 kkvh