Live data from Hacker News

Modeless Vim

github.com

341–350 of 398 posts

Re: Modeless Vim

#341

Earlier quoted context omitted.

As my sibling commenter said, use Karabiner Elements if you are on macos. Though it's not an out-of-the-box thing. Add this config to ~/.config/karabiner/assets/complex_modifications/custom-capslock.json { "title": "Change caps_lock to Esc and Control", "rules": [ { "description": "Post Esc if Caps is tapped, Control if held.", "manipulators": [ { "type": "basic", "from": { "key_code": "left_control", "modifiers": {…

Ooh! Can I do this with "z" and "/" (letter if tapped, control if held)?

Yep! You can do whatever you want with complex modifications. The only tricky part is figuring it out. It shouldn't be TOO different than the above if you replace the appropriate values.

Re: Modeless Vim

#342

Earlier quoted context omitted.

As my sibling commenter said, use Karabiner Elements if you are on macos. Though it's not an out-of-the-box thing. Add this config to ~/.config/karabiner/assets/complex_modifications/custom-capslock.json { "title": "Change caps_lock to Esc and Control", "rules": [ { "description": "Post Esc if Caps is tapped, Control if held.", "manipulators": [ { "type": "basic", "from": { "key_code": "left_control", "modifiers": {…

Ooh! Can I do this with "z" and "/" (letter if tapped, control if held)?

My GUESS is that it would be something like this:

    {
      "title": "Hold z or / for control",
      "rules": [
        {
          "description": "Hold z for control",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "key_code": "z",
                "modifiers": {
                  "optional": [
                    "any"
                  ]
                }
              },
              "to_if_alone": [
                {
                  "key_code": "left_control"
                }
              ]
            }
          ]
        },
        {
          "description": "Hold / for control",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "key_code": "/",
                "modifiers": {
                  "optional": [
                    "any"
                  ]
                }
              },
              "to_if_alone": [
                {
                  "key_code": "right_control"
                }
              ]
            }
          ]
        }
      ]
    }

Re: Modeless Vim

#343

Earlier quoted context omitted.

Power of Vi is that its keybindings are way more ergonomical compared to IBM CUA. If you're a touch typist. It doesn't make sense to change Vi/Vim/NeoVim keybindings because they're so convenient, composable and easy to remember.

That is only the case if you think you have to press Ctrl using your pinky. You can use the side if your palm instead. Then CUA suddenly becomes very ergonomic. Try it. I've done this for over 15 years now across a plethora of different keyboards and also survived several years of Emacs unharmed thanks to it.

I used to do approximately this, from maybe the mid-90s to 2015-ish, but finally that keyboard died (RIP dear friend) and I find that it doesn't work properly on any keyboard I've found since.

Not quite the side of my palm, but the joint where my pinky meets my palm. My hands are relatively large, dunno if that's relevant.

I should put more work into buying a keyboard that it does work on, I think using my finger for Ctrl might be starting to cause RSIs in my middle-aged hands.

I guess I'll also add that for me it's a bigger deal when gaming than when using CUA. That Ctrl button is the one true place to put crouch, dangit.

Re: Modeless Vim

#344
post #130

Earlier quoted context omitted.

Yeah but it’s a small island. If you learn Vim you’ll have access to Vi and Vi-like interfaces in lots of other software including terminals, database clients and everything that uses readline.

Curious what kind of interfaces you're thinking about? (Aside from vi, vim, nvim) From my experience anything with "vi navigation" basically just means using the home row keys for navigation + modes. So I haven't come across many interfaces yet where the verb order differences between helix/vim come into play.

Shells have Vi mode: bash, fish, zsh.

Re: Modeless Vim

#345
post #79
post #57

Earlier quoted context omitted.

> But since I was logging into different machines all the time We now have actually portable executables (multiplatform, multios) that contain their own config file: you can just scp 1 binary and be done with it.

Do you have a link to this? It is not always possible, arcane non x86 arches, low bandwidth connections, but time is the big thing. A binary upload just to change some lines in a machine on the other side of the world. I am lazy.

for vim aarch64 and x86-64 : https://github.com/csdvrx/CuteVim

just embed your own vimrc with zip following the instructions

for others, see https://cosmo.zip/pub/cosmos/bin/

Re: Modeless Vim

#346
post #46

Earlier quoted context omitted.

> I hate how they do it What exactly do you hate? The site says: > > Ctrl+S to save, select text using Shift+←/→/↑/↓, and copy/paste using Ctrl+C/V. I haven't setup Control-S, but I have very similar bindings: Shift and arrows for selecting, then Alt or Control-Shift for moving the selection around, as shown on https://raw.githubusercontent.com/csdvrx/CuteVim/main/record... Also, like the author I have a shortcut to…

Remapping Ctrl-O denies the ability to switch modes. That’s what turns this from simply an opinionated config to a breaking change.

That's fair, changes should try to preserve existing uses

Re: Modeless Vim

#347

Earlier quoted context omitted.

Yes, CapsLock is useless, and I've been remapping it to Ctrl since forever, which serves me a lot more than Esc.

It can be both if you care to. You don't have to choose

I've done Esc-on-single-press-Ctrl-on-hold once, but some games don't recognize the Esc press. Couldn't get to a menu anymore :P

Currently just have Esc on the CapsLock.

Re: Modeless Vim

#348
post #147

Earlier quoted context omitted.

That's why I think MacOS is superior: it actually uses the "meta" key for useful stuff. So, Cmd-W would close the tab, and Ctrl-W would probably still delete a word (can't check right now, but it has a lot of 80s-era keyboard shortcuts for text still working)

macOS uses a lot of Emacs bindings. Ctrl-a for beginning of line, ctrl-e for end, etc etc. And, agreed, macOS' use of shortcuts is fantastic and I wish I could replicate it on Linux.

I use emacs and I respect emacs developers, but it is not originally emacs bindings: http://unix-kb.cat-v.org/

Re: Modeless Vim

#349
post #43

IBM CUA I’ve always wondered how different Unix/Linux would be today if decades ago a Common User Access (standardized menu system like FILE | EDIT | etc) had been defined for TUI apps (like how it was for Windows & Mac OS). Imagine VI & EMacs having the same key bindings due to standards. https://sqlite.org/hctree/doc/hctree/doc/hctree/index.html#s...

Emacs has a mode called cua-mode with keybindings thats more simillar to ones from other modern gui programms like browser.

Re: Modeless Vim

#350
One thing I sorely miss with vim (and which sold me to vscode - yes, I know) is editing in multiple places at once (not sure about the correct term). You select some text, press Ctrl+d to select another one, if you want to skip one Ctrl+k d, then just edit in multiple places at once. Simple and sooo useful, because you actually see each selection before you edit it, and you can select them one by one (or skip, or go back). Alternatives with vim that I found were not quite as helpful, but I'd love to learn I missed something.
Post reply on HN