k9s icon indicating copy to clipboard operation
k9s copied to clipboard

refactor: remove unused sorting key bindings from various views

Open uozalp opened this issue 1 month ago • 6 comments

This resolves #3660 Note: PR #3650 depends on this change.

uozalp avatar Nov 06 '25 08:11 uozalp

@derailed I have resolved the merge conflicts

uozalp avatar Nov 16 '25 16:11 uozalp

@uozalp Thank you for this cleanup! I think it looks good but for views that are k9s specific or non k8s resources we should keep the key sorts as these would not change and allow for quick sort without requiring users to column scroll Would this make sense?

derailed avatar Nov 16 '25 16:11 derailed

@derailed Shift+S is now used for "Sort Selected Column", but several views also use Shift+S for sorting specific columns (Status, Severity).

This creates conflicts in:

Helm History, Helm Chart, Workload views (Shift+S for Status) Image Scan view (Shift+S for Severity)

I see three options to resolve this:

  1. Assign new key bindings for Status/Severity sorts to avoid the Shift+S conflict
  2. Keep most sorts, remove only the conflicting ones (Status/Severity)
  3. Remove all sorting shortcuts from k9s-specific views and rely solely on the column cycle feature

Personally, I lean towards option 3 because:

  • These views are typically not the most frequently used
  • The column cycle feature (Shift+S) provides a universal, discoverable way to sort any column

I only use port forwards, and it often has 0-2 entries, honestly don't need to sort such small tables.

I'm happy to implement whichever approach you prefer for the project. What do you think?

Alias

Key Binding Sorts By
Shift+R Resource
Shift+C Command
Shift+A API-Group

Port Forward

Key Binding Sorts By
Shift+P Ports
Shift+U URL

Reference

Key Binding Sorts By
Shift+V GVR

Image Scan/Vulnerability

Key Binding Sorts By
Shift+L Library
Shift+S Severity
Shift+F Fixed-in
Shift+V Vulnerability

Helm History

Key Binding Sorts By
Shift+N Revision
Shift+S Status
Shift+A Age

Helm Char

Key Binding Sorts By
Shift+S Status

Workload

Key Binding Sorts By
Shift+K Kind
Shift+S Status
Shift+R Ready
Shift+A Age

Vulnerability Extender

Key Binding Sorts By
Shift+V Vulnerabilities

uozalp avatar Nov 17 '25 08:11 uozalp

@umut Good point! I do think S for sorting might not be the best choice given a lot of k8s/crd resources do expose Status which is a natural choice. Perhaps we should shift our wording from sort to order and expose O for column sorting vs S?? Of all the k9s views, I think alias, workload and helm would benefit from direct ordering shortcuts. And we can add status along with name, namespace and age as default shortcuts...

What do you think?

derailed avatar Nov 17 '25 18:11 derailed

@derailed I added shortcut bindings for the non-k8s views, changed the column-sort selection to SHIFT+O, and added SHIFT+S (sort by status) globally. Apologies if I messed anything up. It’s easy to lose track when looking at all those shortcut bindings.

uozalp avatar Nov 17 '25 20:11 uozalp

@derailed Fernand, are we missing anything, or is there anything else that needs to be cleaned up?

uozalp avatar Dec 01 '25 17:12 uozalp