• You are not logged in.

    Simple vim "HNEI" configuration?

    • Started by colemux
    • 6 Replies:
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 45

    I'm sure this is very simple for you real vim users out there, but as a simple emacs user who nevertheless uses vim for small edits (in default configuration when I'm using QWERTY, but now I'm using a Colemak keyboard), I can't find anything here that says explicitly how to achieve the following "HNEI" mapping?

    N -> J
    E -> K
    I -> L
    J -> N
    K -> E
    L -> I

    What's the best way to do that?

    Offline
    • 0
    • Reputation: 0
    • From: Tamil Nadu
    • Registered: 24-Jul-2020
    • Posts: 1

    K -> E
    L -> I

    I try these two, let me try others.

    Offline
    • 0
    • Reputation: 124
    • From: Oslo, Norway
    • Registered: 13-Dec-2006
    • Posts: 4,849

    I don't. For one, I often have Extend which does the navigation thing anyway. Then, the arrows often aren't the best way of navigating anyway. Then, you want to be able to use any fresh Vim efficiently. I know the last argument is in conflict with all the Colemak mods I'm running whenever I get on a fresh computer, but I can use a USB-2-USB QUICKIE with any computer but not always tweak Vim.

    I tried to mod Vim, and it got more and more involved. Whenever you get more advanced you realize there's something that you broke with your mod. Finally I ditched all that and opted for a clean slate Vim.

    So my advice is to just learn to use Vim better, without moving anything around.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Online
    • 0
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 45
    colemux said:

    I'm sure this is very simple for you real vim users out there, but as a simple emacs user who nevertheless uses vim for small edits (in default configuration when I'm using QWERTY, but now I'm using a Colemak keyboard), I can't find anything here that says explicitly how to achieve the following "HNEI" mapping?

    N -> J
    E -> K
    I -> L
    J -> N
    K -> E
    L -> I

    What's the best way to do that?

    Here's what I just configured:

    $ cat ~/.vim/vimrc
    :noremap n j
    :noremap e k
    :noremap i l
    :noremap j n
    :noremap k e
    :noremap l i
    :noremap N J
    :noremap J N

    Seems to work.

    edit: added inverse mapping so e.g. l works to enter insert mode, and N to join lines -- this all (to the best of my limited vim keys knowledge) matches spacemacs' behaviour with:

       dotspacemacs-configuration-layers
       '(
    ...
         (keyboard-layout
           :variables
           kl-layout 'colemak-hnei)
    ...
    Last edited by colemux (30-Jul-2020 23:41:51)
    Offline
    • 0
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 45
    DreymaR said:

    I don't. For one, I often have Extend which does the navigation thing anyway. Then, the arrows often aren't the best way of navigating anyway. Then, you want to be able to use any fresh Vim efficiently.

    I'm using an ergodox keyboard and very used to navigation with those keys, and I spend almost all my keyboard time (heck, almost all my time) at my own keyboard on a computer I control.  And my productivity is terrible if I'm not using my own emacs configuration -- I'm at peace with that.

    I think the hjkl placement in Colemak is just bad for vim-like navigation, and for keys this common that seems a silly choice for my circumstances.  HNEI seems like the next most standard choice, and spacemacs seems to behave quite reasonably with my emacs habits (thanks to other people's hard work).  My vim usage is confined to occasional config file editing and a few other things like that.  YMMV of course.

    Offline
    • 0
    • Reputation: 124
    • From: Oslo, Norway
    • Registered: 13-Dec-2006
    • Posts: 4,849

    Well, "Vim-like" navigation with a nav line sucks anyway. So I'd still look to get better than that.  ¯\_(ツ)_/¯

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Online
    • 0
    • Reputation: 69
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 758

    This HJKL vim thing seems to come up so often, but I really can't understand it. Yes, I recognise there is some muscle memory involved, independent of the actual letters. But if you are the kind of person who is willing to switch from Qwerty to Colemak, relearning the HJKL pattern seems like a small thing. Especially when you consider that HJKL is objectively not very good. I mean, even JKL; would have been more logical.

    In these days where the arrow key pattern is so standard, to the point where even games use WASD universally,  I don't know vim users - especially alternative layout vim users - are still so keen on the HJKL pattern. Even if you don't want to adopt Extend for some reason, and would rather remap keys your vimrc, it's strikingly clear to me that UNEI is the better way to go.

    Last edited by stevep99 (31-Jul-2020 13:46:29)

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0