News for hackers. Stuff that matters.
Re:Vim.wasm by nnq on Thursday April 25, 2019 @06:04AM (#19746553)

  Ctr+[
Vim-ing on devices with not physical Esc key makes you get used to this (default configured, no extra keymapping required) Esc alternative :P
Re:Vim.wasm by latexr on Thursday April 25, 2019 @10:01AM (#19748175)
I really dislike shortcuts with `[` and similar keys. Design software also tends do use them. On a Portuguese keyboard layout[1], I need to press ⌥8 to get `[`. So shortcuts like ⌃[ become ⌃⌥8, which in vim produces `8`.

[1]: https://en.wikipedia.org/wiki/File:KB_Portuguese.svg

Re:Vim.wasm by yoodenvranx on Thursday April 25, 2019 @10:57AM (#19748826)
That's why I use the EurKEY [1] layout on all my machines!

This way I can use all the default US-based shortcuts for emacs/vim/... while still being able to easily type the special chars for my native language, e.g. pressing AltGr+o results in 'ö'.

This method is slightly inconvenient for typing long texts but for me it's still the perfect solution to such problems.

[1]: https://eurkey.steffen.bruentjen.eu/start.html

Re:Vim.wasm by reirob on Saturday April 27, 2019 @07:42AM (#19765051)
I was not aware of this, but found a similar solution that is available almost on any computer: On Linux (my main work environment) I use the English International with AltGr Dead Keys. This gives me a lot of European (and other) accents by combining AltGr+<Accent simulation key> <Letter on which to put the accent>.

Examples:

ä - AltGr+" a (the double quote looks visiually like 2 dots)

ç - AltGr+, c

õ - AltGr+~, o

and so on. I found this solution very practical, even if quite late in my life (went from German QWERTZ, to French AZERTY, to end up with QWERTY), because QWERTY is available everywhere, even if I have to work remote through Windows computers, and it is much much friendlier than AZERTY/QWERTZ. Additionally it gives me to write with the same layout German, French, Portuguese, etc. And it is very easy to remember how to get the accents, because the used signs are visually close.

Re:Vim.wasm by Fnoord on Friday April 26, 2019 @05:50AM (#19755952)
Why the Windows key though? Not everyone runs Windows. Call it Super. That covers every OS, including Windows and Mac. Also, caps lock is arguably useless. First thing I rebind... on Windows with a *.reg key, on macOS with Karabiner Elements.
Re:Vim.wasm by nnq on Monday April 29, 2019 @04:47AM (#19776803)
That's really cool. But if only care about English + French + Spanish and similar languages just using US-Standard layout on a Mac gives you similar benefits, and instead of the norther-European languages you get more common math symbols and greek letters :P

But anyway, EurKEY would be a sane standard in Europe, instead of the hellish borderline-inusable national standard keyboards...

Re:Vim.wasm by wang_li on Thursday April 25, 2019 @11:31AM (#19749176)
Technically ESC is the shortcut key for ctrl-[.
Re:Vim.wasm by nnq on Monday April 29, 2019 @04:41AM (#19776781)
Any keyboard used by a programmer should have direct one-key access to `[` and to all the 0-9 numbers...

For every shortcut you can imagine you can find at least one keyboard layout out there where it's inconvenient.

Just get over the crappy nationalized keyboard layouts and use US English keyboards like all programmers do!

I can type French + English + Romanian just fine and comfy (would also work for Spanish + Italian fine, northern languages might be a bit of an issue...), with all the accents and special chars of each language, on a US-English layout keyboard that also has `[` and ``` (backtricks) and all the 0-9 numbers available one keystroke away. Mac keyboards work fine by default, the Windows ones might ned fiddling around with picking US vs US-Intenational and windows quote character settings until you get it right.

Western European keyboard layouts (except British) are just plain broken imo, you can't need more than one key to type a damn `[` (array access), or force ppl to use Shift to type numbers, wtf.

Otoh, typing Lisp code on a French keyboards is kinda' cool in a way :P

Re:Vim.wasm by b1gtuna on Thursday April 25, 2019 @09:34AM (#19747870)
Whoa, I was not aware of this. Now I can completely avoid using the touchbar!
Re:Vim.wasm by apetresc on Thursday April 25, 2019 @10:02AM (#19748184)
You can also remap a key like Caps Lock to Escape, straight from System Preferences on macOS (unless you're already remapping it to Ctrl or something)
Re:Vim.wasm by jtms on Thursday April 25, 2019 @11:44AM (#19749320)
Caps lock remapped to esc is definitely a great solution - I have been using it for years
Re:Vim.wasm by joshstrange on Thursday April 25, 2019 @10:27AM (#19748480)
I do this and while I'm on my magic keyboard I sometimes forget and keep using the physical Esc key. I need to see if I can use something like BTT/Keyboard Maestro to respect the physical (or Touchbar) Esc key but send a notification of something like "You should use the Caps Lock Key instead" to help train myself better. I will say it's really nice that macOS makes it stupid easy to map Caps Lock to Esc and it work flawlessly for me.
Re:Vim.wasm by msla on Thursday April 25, 2019 @12:34PM (#19749817)
In Emacs, we remap Caps Lock to Ctrl.

Does anyone actually like Caps Lock?

Re:Vim.wasm by ianmcgowan on Thursday April 25, 2019 @12:46PM (#19749942)
I PROGRAM IN A LEGACY ENVIRONMENT THAT USES CAPS ONLY. I LOVE CAPS LOCK AND FIND IT ANNOYING TO HAVE TO SWITCH BACK AND FORTH WITH SHIFT.

so emails and general writing tend to be all lower case and rely on the editor to upcase for me. mostly works.

Re:Vim.wasm by scott_s on Thursday April 25, 2019 @10:40AM (#19748632)
I did this recently. An upgrade to a Mac with a touchbar prompted it, but I should have done it over a decade ago.
Re:Vim.wasm by airstrike on Thursday April 25, 2019 @09:46AM (#19748000)
Man, what a sad statement...
Re:Vim.wasm by dfinninger on Thursday April 25, 2019 @10:26AM (#19748466)
I get where they are coming from. I find the touch bar pretty neat and useful... But it's dynamic and I don't want that to interfere with pure muscle memory tasks like typing.
Re:Vim.wasm by teddyh on Thursday April 25, 2019 @06:54AM (#19746792)
In many terminals (especially old ones), Ctrl-3 also commonly gives ESC.
Re:Vim.wasm by equalunique on Thursday April 25, 2019 @10:39AM (#19748616)
I like that in spite of this requiring two fingers, each finger on it's own has to move less distance than one would in order to reach Esc.
Re:Vim.wasm by qubitcoder on Thursday April 25, 2019 @02:47PM (#19751295)
Remapping Caps Lock to Control makes the motion even easier.
Re:Vim.wasm by equalunique on Monday April 29, 2019 @10:06AM (#19778435)
I have a couple "HHKB" layout boards which do that. It is quite helpful!

What I have found even more useful is triggering a "layer" when Caps Lock is held down, which turns H, J, K, & I into an arrow cluster; U & O into Page Up / Down; and P & ; into Home / End. To toggle regular Caps Lock, I just activate the layer and then hit A. It's a big time saver! :)

Re:Vim.wasm by bkanber on Thursday April 25, 2019 @07:51AM (#19747067)
Frankly I prefer Ctrl-[ over Esc because it requires less hand movement.
Re:Vim.wasm by dmitryminkovsky on Thursday April 25, 2019 @08:03AM (#19747137)
Rebound my caps lock to escape and never looked back!
Re:Vim.wasm by mrzool on Thursday April 25, 2019 @09:01AM (#19747610)
You should (look back). Mapping it to Ctrl is a much more sensible choice. Can’t imagine using backspace instead of Ctrl-h, or Ctrl-A/E to go to the beginning/end of line, or Ctrl-W to delete back one word etc. Of course, Ctrl-[ is also right under your finger tips with Caps Lock mapped to Ctrl.
Re:Vim.wasm by jolmg on Thursday April 25, 2019 @12:45PM (#19749932)
> Ctrl-W to delete back one word

That's one of the most commonly used shortcuts I use. Not just in vim, but also in the shell. When I screw up on my typing, the mistake is often 3 or more letters back. Instead of hitting backspace a lot or moving the cursor and retyping mid-word, I prefer to say "screw it", hit Ctrl-w, and retype the word. It's faster. My brain is just not optimized to type pieces of words. I can't use muscle memory then.

Besides that, I don't know about you or dmitryminkovsky, but I remapped it to Caps system-wide, so by remapping to Ctrl, I'd be losing a lot more than those shortcuts you mentioned. On the other hand, CapsLock has always been a useless key to me. When I want to type in all-caps, it's less confusing/error-prone to just hold Shift with my pinky while typing. Also, Caps is in a much easier place to hit than Ctrl, so it's more fitting for a key that I hit a lot.

Re:Vim.wasm by jwandborg on Thursday April 25, 2019 @04:02PM (#19751973)
Speaking of Emacs key bindings: Alt+D, for when you've made a typo in the future.
Re:Vim.wasm by jolmg on Thursday April 25, 2019 @04:15PM (#19752096)
The equivalent of Ctrl-w in emacs is Ctrl-Backspace. It's more common to want to delete the word you just typed instead of the word to the right of the cursor.
Re:Vim.wasm by meestaahjoshee on Thursday April 25, 2019 @09:23AM (#19747775)
you can do tap for esc, hold for ctrl
Re:Vim.wasm by hultner on Thursday April 25, 2019 @09:37AM (#19747903)
This is what I've done for years now, best thing since sliced bread.
Re:Vim.wasm by dmitryminkovsky on Thursday April 25, 2019 @10:40AM (#19748629)
Tap what?
Re:Vim.wasm by stevelosh on Thursday April 25, 2019 @01:52PM (#19750725)
They mean remapping capslock to:

* Ctrl if held and used with other keys.

* Esc if pressed and released on its own.

There's no reason to press and release Ctrl on its own (minus games), and you never need to chord Esc with anything else, so they can both live on the same key.

Re:Vim.wasm by dmitryminkovsky on Thursday April 25, 2019 @02:23PM (#19751066)
Thank you for explaining. Didn't know you could do that. Will look it up.
Re:Vim.wasm by dmitryminkovsky on Thursday April 25, 2019 @10:40AM (#19748624)
> You should (look back).

Tell me about it!

> Mapping it to Ctrl is a much more sensible choice.

Never considered this, but just moved my pinkie to Ctrl and then to Esc and then to Ctrl... hmm... I use Emacs bindings in Insert Mode, wouldn't this interfere with them?

Re:Vim.wasm by mrzool on Thursday April 25, 2019 @12:01PM (#19749490)
On the contrary, mapping caps lock to ctrl makes emacs keybindings super accessible! That’s exactly my point. I even disabled the backspace to force myself to use Ctrl-H instead. It’s all in the home row!

Added bonus: on MacOS, emacs keybindings work in pretty much every place where you can input text, so you get’em everywhere. It’s part of the Cocoa Text System:

http://www.hcs.harvard.edu/~jrus/site/system-bindings.html

Re:Vim.wasm by dillonmckay on Thursday April 25, 2019 @09:09AM (#19747660)
...and on my laptop, those are both physical keys with tactile sensations!
Re:Vim.wasm by ngokevin on Thursday April 25, 2019 @07:38PM (#19753541)
I have it on `jj`. No hand movement at all, less pinky-bending.
Re:Vim.wasm by m463 on Friday April 26, 2019 @01:17AM (#19755025)
Do you have a minimal keyboard?

Vim would be a particularly good editor since most operations are simple and elegant with only an occasional exit of insert mode.

but emacs... probably not as fun.

Re:Vim.wasm by tjoff on Thursday April 25, 2019 @08:37AM (#19747392)
Unfortunately doesn't work for us that access [ via the AltGr layer. Unless someone knows of a workaround?
Re:Vim.wasm by ryanmonroe on Thursday April 25, 2019 @09:11AM (#19747676)
Ctrl-C also works