abrochard / kubel

Emacs extension for controlling Kubernetes with limited permissions
GNU General Public License v3.0
259 stars 41 forks source link

Bind `n` and `p` to next and previous line respectively #108

Open jumper047 opened 1 year ago

jumper047 commented 1 year ago

I think it'll better fit for non-editable mode. Also this is how these bindings works almost everywhere across Emacs in similar modes

abrochard commented 1 year ago

Hi @jumper047 , Thank you for sharing this. Do you have examples of other modes that do that? I just to make sure we get the UX right

jumper047 commented 1 year ago

Thank you for not rejecting this issue:) - app defaults can be very sensitive question. Regarding examples: just some of them which comes to my mind and I'm using often: dired, ibuffer, magit, mentor (torrent client), treemacs, dap-mode

fbergroth commented 1 year ago

kubel-mode is deriving from tabulated-list-mode and is overriding the standard n and p bindings from the tabulated-list-mode-map, and also S (tabulated-list-sort), which is kinda useful.

abrochard commented 1 year ago

I reviewed the code and I now remember why n and p aren't used for next and previous line respectively:

It's not crazy to imagine a new set of keybindings for these methods and restore n and p to their "sensible" defaults values but it would be a breaking change and very confusing at first.

jumper047 commented 1 year ago

Personally I rebound namespaces and ports to N and P respectively in my config, and pretty happy with it:). Still think it's better choice than default one, but also this change will be really confusing for existing customers.. So I suppose it's better to leave it as is. Can I close this issue, or it will be good place for further discussion (if any)?

abrochard commented 1 year ago

Oh that's a pretty good suggestion. Leave this issue open please, I'm going to think about it!

Kyrremann commented 9 months ago

This has also been irritating me, so I solved it by extending the key map.

(use-package kubel
  :bind (
         (:map kubel-mode-map
               ("N" . kubel-set-namespace)
               ("P" . kubel-port-forward-pod)
               ("n" . #'next-line)
               ("p" . #'previous-line))))

By adding ("S" . #'tabulated-list-sort) you can easily sort the list and reverse it (this is by column Meta + left/right), but then you need to find a different key binding for scaling. I ended up using ("M-s" . kubel-scale-replicas).