You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
Hi! There's no way for enabling vim-like movement in the current release. The keybindings clash with existing commands, so I'm wary of adding that. But thanks for the suggestion, I'll keep it filed in the "wishlist" label.
Reacted by Kevin Mok, Johannes, Florian Suess, Max Coplan, jcnoronha, Cameron Flint, Alex Alekseyenko, mihleonid, Tomas Gonzalez and Kayomars Abedian
Here is a patch which offers very basic vi like keybindings https://pastee.org/bny2j
The key bindings which clash with existing ones seem to have also been
rebound in the patch, and from a very quick test on htop 1.0.3 from git
it seems to work fine.
Reply to this email directly or view it on GitHub: #98 (comment)
@zkanda it might be a limitation of your terminal. Open a shell, type read and press Enter. It will give you a prompt that will echo the ANSI codes for your keypresses. Type hjkl with and without Alt. It should produce different results. If the results are the same, htop has no way to detect that Alt was pressed. In my system it shows:
@zkanda That's odd! Keys from read are working as expected. Could you try it on another terminal you might have installed (xterm)? It might be an ncurses configuration issue? I'm at a loss here.
Would it be possible to set this as a config variable at compile-time or preferably in an rc file or on the command line? I use Alt+{h,j,k,l} for moving through windows in my tiled window manager so the plain keys (non-Alt) in the patch above work best for me.
Okay, I tried it on xterm without any configuration and it seems to worsen the situation. read is printing weird non ascii characters.
Here's the result: https://asciinema.org/a/2mmhmyenvhg97awgcxtn3hkjf
I'm on ArchLinux with Gnome as my DE if that matters.
I use htop on OS X 10.11.5, I tested under following combinations:
- Terminal.app + [zsh / bash] + htop
- iTerm.app + [zsh / bash] + htop
- iTerm.app + tmux + [zsh / bash] + htop
All with no luck.
The read on iTerm.app behaves as expected: ^[j^[k
The read on Terminal.app spits out weird symbols: ∆˚
Doesn't work in my mac with Iterm nor Terminal too. I was thinking about an alternative key binding user can switch to in settings. This way nothing will break for other users but users who prefer to use vim key bindings can use it by activating it in settings.
@sassanh, for Alt+{h,j,k,l} to work as expected in macOS, the Option key needs to be configured as +Esc (iTerm2) or Meta Terminal, in Preferences > Profile > Keyboard.
Still doesn't work not in iTerm nor Terminal. I tried all 3 choices for Option key in iTerm and the 2 in Terminal. Also htop is not the only application I run in terminal. Changing option key will ruin my key bindings for vim, fish, etc.
Activity
hishamhm commentedon May 23, 2014
Hi! There's no way for enabling vim-like movement in the current release. The keybindings clash with existing commands, so I'm wary of adding that. But thanks for the suggestion, I'll keep it filed in the "wishlist" label.
darvelo commentedon May 28, 2014
👍
Vndtta commentedon May 28, 2014
You are awesome, thanks!
On May 24, 2014 3:38:48 AM CEST, Michael notifications@github.com wrote:
-- Calm Down and Keep Seeding --
e9t commentedon Sep 16, 2015
One vote up +1 for this wish!
zkanda commentedon May 18, 2016
Hello, was this ever implemented?
Thanks
hishamhm commentedon May 19, 2016
it was added as Alt+{h,j,k,l}.
zkanda commentedon May 20, 2016
Hmm, weird, my version of htop is 2.0.1, but it doesn't seem to work.
kaefer commentedon May 20, 2016
It works (here on my machine with german keyboard layout) with pressing the left-alt button (alt and not alt-gr)
hishamhm commentedon May 20, 2016
@zkanda it might be a limitation of your terminal. Open a shell, type
readand press Enter. It will give you a prompt that will echo the ANSI codes for your keypresses. Typehjklwith and without Alt. It should produce different results. If the results are the same, htop has no way to detect that Alt was pressed. In my system it shows:hisham@pointer ~]read hjkl^[h^[j^[k^[lzkanda commentedon May 23, 2016
My terminal seems to be working as expected. Using gnome-terminal.
Can you please confirm this behavior?
https://asciinema.org/a/6kvkdo6szprhqcrpi7z1ctn2e
hishamhm commentedon May 24, 2016
@zkanda That's odd! Keys from
readare working as expected. Could you try it on another terminal you might have installed (xterm)? It might be an ncurses configuration issue? I'm at a loss here.darvelo commentedon May 26, 2016
Would it be possible to set this as a config variable at compile-time or preferably in an rc file or on the command line? I use Alt+{h,j,k,l} for moving through windows in my tiled window manager so the plain keys (non-Alt) in the patch above work best for me.
zkanda commentedon May 27, 2016
Okay, I tried it on
xtermwithout any configuration and it seems to worsen the situation.readis printing weird non ascii characters.Here's the result: https://asciinema.org/a/2mmhmyenvhg97awgcxtn3hkjf
I'm on
ArchLinuxwithGnomeas my DE if that matters.mudox commentedon Jun 19, 2016
I use htop on OS X 10.11.5, I tested under following combinations:
- Terminal.app + [zsh / bash] + htop
- iTerm.app + [zsh / bash] + htop
- iTerm.app + tmux + [zsh / bash] + htop
All with no luck.
The
readon iTerm.app behaves as expected:^[j^[kThe
readon Terminal.app spits out weird symbols:∆˚sassanh commentedon Oct 29, 2017
Doesn't work in my mac with Iterm nor Terminal too. I was thinking about an alternative key binding user can switch to in settings. This way nothing will break for other users but users who prefer to use vim key bindings can use it by activating it in settings.
ryenus commentedon Oct 29, 2017
@sassanh, for Alt+{h,j,k,l} to work as expected in macOS, the Option key needs to be configured as
+Esc(iTerm2) orMetaTerminal, in Preferences > Profile > Keyboard.sassanh commentedon Oct 29, 2017
Still doesn't work not in iTerm nor Terminal. I tried all 3 choices for Option key in iTerm and the 2 in Terminal. Also htop is not the only application I run in terminal. Changing option key will ruin my key bindings for vim, fish, etc.
sassanh commentedon Oct 29, 2017
I ended up using https://github.com/KoffeinFlummi/htop-vim.
bbugyi200 commentedon Apr 29, 2019
Here's a more up-to-date patch (it works with v2.2.0) that implements this if anyone is interested: https://gist.github.com/bbugyi200/c066a5b56819c629f41f8805804e5204
vegerot commentedon Jan 17, 2020
The patch is very readable, but for the lazy you may be wondering how to access the old htop functionality previously mapped to "hkl".
The answer is: