• You are not logged in.

    Simple vim "HNEI" configuration?

    • Started by colemux
    • 10 Replies:
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 61

    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: 210
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,343

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

    Offline
    • 0
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 61
    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: 61
    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: 210
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,343

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

    Offline
    • 0
    • Reputation: 117
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 975

    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-DH with Seniply.

    Offline
    • 0
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 61
    DreymaR said:

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

    What do you mean by nav line?

    Sucks compared to what?

    Offline
    • 0
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 61
    stevep99 said:

    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.

    My take on it is: I don't mind relearning, but not to move to a worse layout (like HJKL in Colemak, or should I call it HYNU?).

    stevep99 said:

    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.

    I assume you meant to write "I don't know *why* vim users are still so keen on the HJKL pattern".  I still use QWERTY at work so I'm sticking to HJKL physical keys for now.  Also, my reasons for switching to Colemak don't require me to switch this.  I'm curious to see actual tests on this to try and show it's objectively better though.

    Offline
    • 0
    • Reputation: 210
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,343
    colemux said:

    What do you mean by nav line?

    Sucks compared to what?

    I mean a line with the navigation arrows. And it's compared to using proper Vim navigation (with / etc) and Extend. You've read the BigBag Extend topic, right?

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

    Offline
    • 0
    • Reputation: 9
    • Registered: 24-Aug-2019
    • Posts: 61
    DreymaR said:
    colemux said:

    What do you mean by nav line?

    Sucks compared to what?

    I mean a line with the navigation arrows. And it's compared to using proper Vim navigation (with / etc) and Extend. You've read the BigBag Extend topic, right?

    Ah I see, thanks.

    Well, I don't think anybody uses / for ALL navigation, because that would be silly :-)  And HJKL / HNEI is fine for a lot of motion.

    As for HJKL line vs. a more WASD-style arrow layout, I'm not persuaded that my navigation time depends a lot on that change, partly for the sort of reason you cite: I don't exclusively use HJKL/HNEI navigation, I use lots of different ways to move around files.

    I was going to write: "Extend isn't really relevant if you have a split keyboard I guess (I do all my Colemak typing on an Ergodox keyboard)."  No, I *did* write that.  But then I googled it just to check and I see it's not about moving the left and right sets of home keys apart horizontally at all, but about having a different layer (or modifier, if you prefer) for special keys.  I've certainly thought about doing that -- but haven't done it yet (except for the standard ones that just didn't fit because of lower Ergodox key count).  I guess any standard layout like this is going to suffer from the problem that people's usage statistics for these special symbols must vary enormously in very idiosyncratic ways, unlike the situation for typing English text, where you can make a clear case that an individual is unlikely to be much more successful in coming up with a good layout that Shai has been, for example.  So I guess if I were to start using a symbol / navigation layer, I'd be likely to make up my own layout.  I'm grateful that you've put your design out there for other people to learn some good ideas from though, I think it's going to take me looking at others' ideas to figure out what might help me there.

    I think I'll have to pay careful attention to what the slowest special keys (navigation and otherwise) are to type, and how common they are.  Right now, with my weird Ergodox layout, I'm frustrated most when coding, by the symbol keys that have landed on harder-to-reach keys -- for me that's []/{} (on the left top thumb keys) and +/= (on the top right hand key of the left half of the keyboard).  For both symbols and navigation, I'm open to switching layers, but it does have a cost in just selecting the layer in the first place of course -- both the extra key to hit (whether layer toggle or modifier), and the keyboard real estate.  Also, in vim (and emacs' vim clone, evil) "normal" navigation does involve letter keys already, so that's a tricky thing to deal with in a satisfying way if you want to use a layer for navigation, perhaps.  Also in the past I've tried ad-hoc modal navigation (I realize it's not modal you're suggesting exactly) & other commands purely within emacs (using things like hydra, modalka, ryo), but found so far I didn't really use that much.  Perhaps it just hasn't stuck yet, though.

    Offline
    • 0