Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Add simple vim mode #959

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lytedev
Copy link
Contributor

@lytedev lytedev commented Oct 31, 2019

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.

Daniel Flanagan added 4 commits April 6, 2018 21:52
This commit 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 pushed a commit to lytedev/dotfiles that referenced this pull request Oct 31, 2019
@AtomToast
Copy link

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

@lytedev
Copy link
Contributor Author

lytedev commented Feb 10, 2020

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. 😆

@andys8
Copy link

andys8 commented Feb 22, 2020

See #98

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

@nycex
Copy link

nycex commented May 9, 2020

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.

@andys8
Copy link

andys8 commented May 9, 2020

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

@vcfvct
Copy link

vcfvct commented May 23, 2020

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.

@natoscott
Copy link
Collaborator

Merged here: htop-dev/htop@5c5a599

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants