8000 Vim-like movement · Issue #98 · hishamhm/htop · GitHub
[go: up one dir, main page]

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

Vim-like movement #98

Closed
Closed

Description

@Vndtta

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

Activity

  1. hishamhm commented on May 23, 2014

    @hishamhm
    Owner

    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.

  2. darvelo commented on May 28, 2014

    @darvelo

    👍

  3. Vndtta commented on May 28, 2014

    @Vndtta
    Author

    You are awesome, thanks!

    On May 24, 2014 3:38:48 AM CEST, Michael notifications@github.com 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:
    #98 (comment)

    -- Calm Down and Keep Seeding --

  4. e9t commented on Sep 16, 2015

    @e9t

    One vote up +1 for this wish!

  5. zkanda commented on May 18, 2016

    @zkanda

    Hello, was this ever implemented?

    Thanks

  6. hishamhm commented on May 19, 2016

    @hishamhm
    Owner

    it was added as Alt+{h,j,k,l}.

  7. zkanda commented on May 20, 2016

    @zkanda

    Hmm, weird, my version of htop is 2.0.1, but it doesn't seem to work.

  8. kaefer commented on May 20, 2016

    @kaefer
    Contributor

    It works (here on my machine with german keyboard layout) with pressing the left-alt button (alt and not alt-gr)

  9. hishamhm commented on May 20, 2016

    @hishamhm
    Owner

    @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
  10. zkanda commented on May 23, 2016

    @zkanda

    My terminal seems to be working as expected. Using gnome-terminal.

    Can you please confirm this behavior?
    https://asciinema.org/a/6kvkdo6szprhqcrpi7z1ctn2e

  11. hishamhm commented on May 24, 2016

    @hishamhm
    Owner

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

  12. darvelo commented on May 26, 2016

    @darvelo

    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.

  13. zkanda commented on May 27, 2016

    @zkanda

    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.

  14. mudox commented on Jun 19, 2016

    @mudox

    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: ∆˚

  15. sassanh commented on Oct 29, 2017

    @sassanh

    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.

  16. ryenus commented on Oct 29, 2017

    @ryenus
    Contributor

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

  17. sassanh commented on Oct 29, 2017

    @sassanh

    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.

  18. sassanh commented on Oct 29, 2017

    @sassanh
  19. bbugyi200 commented on Apr 29, 2019

    @bbugyi200

    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

  20. vegerot commented on Jan 17, 2020

    @vegerot

    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)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0