k9s
k9s copied to clipboard
Mark-Range bug
In window machine, mark range is not working as expected. When ctrl-space is used on 2 resources separated with some resources in between, and then when ctrl-d is used, only the first and last resource are being selected for the delete.
To add to this - only the first and last items are highlighted in green too (indicating that they're the only ones selected). So it looks like ctrl-space
is literally just doing the same as what space
does.
(I'm on Windows too)
Same here on macos. I'm pretty sure in older versions ctrl+space
worked, I don't know since when but now pressing ctrl+space
doesn't do anything
right, at macos seems is not doing anything
The problem (in my case at leasta) was that macos by default assigns ctrl+space as a shortcut to change the input layout (keyboard language). Disabling the shortcut in macos settings made the range selection work on k9s.
thank you for reply. I actually realized that macos using the same shortcut, but I thought the shortcut is ctrl+space+up/down, when I push ctrl+space nothing happend. and also, I didn't find a way to change that perticular shortcut on macos at keyboard shortcut session
When I pressed ctrl+space nothing happened also, because I only had one language set up (I guess this is your case also), if you add a second language to your keyboard layout and press ctrl+space you'll switch between them.
You need to go to System Settings
-> Keyboard
-> Keyboard Shortcuts
-> Input Sources
:

The screenshot is from Ventura, but in Monterrey and the option was there also.
sorry I didn't post the updated image,I disabled my shortcut, but still not working
however, my case is that, Im using k9s over a web terminal (using xterm), because other shortcut works so I don't know if that makes any difference
my k9s version:
____ .______
| |/ / __ _____
| < ____ / /
| | \ / /_
||__ \ ///___ >
/ /
Version: v0.25.18 Commit: 6085039f83cd5e8528c898cc1538f5b3287ce117 Date: 2021-12-28T16:53:21Z
Does not work for me also.
Note: I discovered some things shortly after initially posting; please read the Edit
comments
Little confused here, in help, I see <ctrl-space>
as kube-system
(which I assume from the description switches to the kube-system
namespace, which I was trying to use to keep it out of my namespace favorites list) and also under RESOURCE
and also <ctrl-space>
as Mark Range
under GENERAL
I'm guessing from the help that the Mark Range
action is context sensitive and is only activated if one has marked a resource, whereas otherwise it would, as I assume, switch to the kube-system
namespace.
Edit 4: Seems like <ctrl-space>
was assigned to kube-system
since that was the last namespace above 10 in my favorites, I thought this was a built in feature with kube-system
being such a common namespace. Seems odd how namespaces above 10, besides the last one, are ignored? But this hotkey does not work, for any namespace I've set.
For me, I'm on Win10, using Windows Terminal (Preview) to ssh into a local WSL instance - since most others who've mentioned the issue are on MacOS but I am not, perhaps there's a deeper or other issue?
Admittedly, I haven't done a full dig to ensure that <ctrl-space>
isn't defined anywhere on my system as a hot key; however, if that IS the case for the MacOS users and even myself, perhaps there should be some configuration settings/options to change/override the default hotkeys?
Edit: I've checked with showkey -a
and indeed <ctrl-space>
is sent to the terminal (at least for my WSL instance, doesn't seem to make it for ssh connections but that's a separate issue):
#> showkey -a
Press any keys - Ctrl-D will terminate this program
^@ 0 0000 0x00
Perhaps the issue is how the key is handled..? As in looking specifically somehow for <ctrl-space>
and not 0x00
/^@
as is common?
The NULL character (code 0) is represented by Ctrl-@, "@" being the code immediately before "A" in the ASCII character set. For convenience, a lot of terminals accept Ctrl-Space as an alias for Ctrl-@.
Edit 2: Hmm, maybe not? I tried in an xterm
window (same WSL instance) and it did work and inside that window, skowkey -a
shows ^@
as expected...
Edit 3: I was trying some things in the xterm
and realized that the kube-system
action never seemed to work, then I tried the Mark Range
again and it didn't work, which confused me. Then I noticed the Mark Range
was only working on the namespace select list - then I went back and checked in my normal terminal and indeed, Mark Range
worked fine in the namespace list but not elsewhere!
I do see that setting custom hotkeys is a possibility and, at least in the kube-system
use-case, should be easy to apply the same effect to a key of my choosing, however, I'd have to do so by using existing commands that can be typed/bound. That seems to make it impossible to create a hotkey to perform an inbuilt action, such as the Mark Range
example.
Also, as mentioned I assume that the kube-system
action would filter the currently selected/displayed resource; I may be missing something (new to k9s) but I'm not sure it's possible to just switch the current namespace by command, intuitively I would've guessed typing :ns new-namespace
would switch, however, using the :ns
command without any argument or with any namespace as an argument both brings me to the namespace list, seems like it's oddly missing the ability to use an argument like most other commands, thus I don't think I could actually manage similar functionality with a defined hotkey in that case either.
Especially as it seems like currently namespace favorites are limited to 10 options (and since there's seemingly a hotkey for it) having kube-system
in my favorites feels like a waste.
As an aside, that limitation feels a bit odd when all 10 favorites are listed in two un-even columns, as if there could be more.
That limitation is likely due to the default-assigned hotkeys for the favorites using numbers 0-9 but I'm sure there's favorable solutions for that, such as using a modifier for the next 10 (eg. ctrl-0, ctrl-1, etc) or rolling over to the symbols under the numbers (10 being !, 11 being @, etc) although unless you're checking keyboard layouts to decide which symbols to use, users with different layouts would see it as less intuitive or potentially annoying.
Another great option to lessen the impact of such a limit would be allowing wildcards/glob/regex to be used for favorites.