Hi, I've searched in the archive of the mailing list and didn't find anything... Sorry if it's been asked before (I guess it must have)
Is there anyway of setting the movement commands like vim? hjkl?
Thank you
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.
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.
:+1:
You are awesome, thanks!
On May 24, 2014 3:38:48 AM CEST, Michael [email protected] wrote:
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:
https://github.com/hishamhm/htop/issues/98#issuecomment-44074271
-- Calm Down and Keep Seeding --
One vote up +1 for this wish!
Hello, was this ever implemented?
Thanks
it was added as Alt+{h,j,k,l}.
Hmm, weird, my version of htop is 2.0.1, but it doesn't seem to work.
It works (here on my machine with german keyboard layout) with pressing the left-alt button (alt and not alt-gr)
@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:
hisham@pointer ~]read
hjkl^[h^[j^[k^[l
My terminal seems to be working as expected. Using gnome-terminal.
Can you please confirm this behavior?
https://asciinema.org/a/6kvkdo6szprhqcrpi7z1ctn2e
@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.
I ended up using https://github.com/KoffeinFlummi/htop-vim.
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
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:
k→x (kill)
l→L (lsof)
h→? (help)
Most helpful comment
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