htop icon indicating copy to clipboard operation
htop copied to clipboard

Add simple vim mode

Open lytedev opened this issue 4 years ago • 7 comments

This PR adds a "vim_mode" setting (false/0 by default) that causes keys to be remapped in the following way by the ScreenManager:

+ h -> LEFT
+ j -> DOWN
+ k -> UP
+ l -> RIGHT
+ LEFT  -> h (toggle help)
+ DOWN  -> j (noop)
+ UP    -> k (open kill menu)
+ RIGHT -> l (lsof current process)
+ K (Shift+K) -> k (open kill menu)
+ J (Shift+J) -> K (toggle show/hide kernel threads)
+ L (Shift+L) -> l (lsof current process)

I couldn't figure out where the manpage documentation is in the repo, though I admittedly did not look particularly hard.

I believe this change would be a welcome option for heavy vim users like myself who would like a familiar way to get around in htop.

lytedev avatar Oct 31 '19 16:10 lytedev

I would like to have an option for vim bindings in normal htop though I prefer the shortcuts implemented by this fork: https://aur.archlinux.org/packages/htop-vim-git
Source code is here https://github.com/KoffeinFlummi/htop-vim

AtomToast avatar Feb 07 '20 12:02 AtomToast

I'll have to check that out! My implementation has issues with the may I remap the keys so that typing k when searching puts the character K into the input string, so this implementation is not particularly good at all. :laughing:

lytedev avatar Feb 10 '20 15:02 lytedev

See https://github.com/hishamhm/htop/issues/98

Would be nice to have a well maintained and packaged fork with vim bindings.

andys8 avatar Feb 22 '20 16:02 andys8

I like this patch overall, though I would leave the keys to what they do at the moment and do something like:

? -> h
q -> k
L -> l

instead, remapping the arrow keys like that wouldn't be very intuitive in my opinion.

nycex avatar May 09 '20 14:05 nycex

Btw there are other system monitors with vim bindings. I'm currently using bottom because it's configurable. There is also ytop and more. Depends on what you need.

https://github.com/ClementTsang/bottom https://github.com/cjbassi/ytop

andys8 avatar May 09 '20 16:05 andys8

Btw there are other system monitors with vim bindings. I'm currently using bottom because it's configurable. There is also ytop and more. Depends on what you need.

https://github.com/ClementTsang/bottom https://github.com/cjbassi/ytop

Thanks for the suggestions. Can finally switch to a modern one with more natural key-bindings. Bottom looks great.

vcfvct avatar May 23 '20 14:05 vcfvct

Merged here: htop-dev/htop@5c5a599

natoscott avatar Aug 20 '20 05:08 natoscott