k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Alter default key-bindings

Open Nicholas-Autio-Mitchell opened this issue 4 years ago • 8 comments




Thanks for this wonderfully useful tool!

Is your feature request related to a problem? Please describe. Some of the essential key-bindings (such as Contol-d to delete a job/pod) conflict with those used in my terminal/TMUX environment, meaning I have to always perform those in another terminal using e.g. kubectl delete pods ....

Describe the solution you'd like A way to change the default key-bindings. Looking in the documentation and skimming the source code, I haven't seen a place to do this myself. I am not talking about the hotkeys option; as far as I can tell, they are a separate feature that also shouldn't contain any of the basic key-bindings.

Describe alternatives you've considered Another YAML file where all keybindings are stored and can be overridden. I am not sure how they are currently implemented, and am not fussy about how a solution may work.

Additional context

Nicholas-Autio-Mitchell avatar Mar 15 '20 12:03 Nicholas-Autio-Mitchell

I have the same issue and I have to browse the code to override the default command: https://github.com/derailed/k9s/search?q=NewKeyAction&unscoped_q=NewKeyAction

what could be great is to generated a default hotkeys.yml so we can easily override and add custom commands

victorboissiere avatar May 13 '20 09:05 victorboissiere

yes and everytime by default I press q

I'm dying to put q instead of Esc

arash-bizcover avatar Aug 11 '20 05:08 arash-bizcover

i cant even use the tool because i use tmux ctrl-a as leader..

dagadbm avatar Aug 19 '20 09:08 dagadbm

It would be great, for example to be able to use the insert key instead of space key to select items (as in mc).

milj avatar Sep 08 '22 12:09 milj

It is possible to define custom key bindings in hotkey.yml. Eg:

hotKey:
  q:
    shortCut:    q
    description: exit
    command:     quit

  Delete:
    shortCut:    Delete
    description: Delete resource
    command:     delete

The first one works like a charm, but I get an error Ruroh? 'delete' command not found with the other.

It's also not possible to overwrite existing key bindings that way.

TLINDEN avatar Apr 11 '23 11:04 TLINDEN

@derailed are there any plans on implementing this?

dudicoco avatar Dec 10 '23 15:12 dudicoco

I found a partial workaround for people that have conflicting bindings with other applicaitons like tmux or that simply would like to use CTRL+Z to minimize K9s. Just edit a defintion with your editor, and then the k9s hotkeys are inactive. When you're done simply exit the editor without saving. It's not the best workaround, I admit.

darthbanana13 avatar Apr 04 '24 19:04 darthbanana13

Has anyone been successful in binding a different key to back? I have <esc> already mapped in my terminal, so I'd rather have something like q be back.

I have a hotkeys.yml like:

hotKey:
  q:
    shortCut: q
    description: Go back
    command: Back

but I get a "Ruroh?" as well for this, presumably because Back is not a valid command.

matthewgrossman avatar May 09 '24 23:05 matthewgrossman