by robinh · 12y ago · 0 comments
A recent poll I posted on HN suggests that I'm in the minority on this one, but I actually don't remap caps lock myself. And I like to think I'm a pretty capable writer, touch typing with a decent WPM.
Consider the following bit of assembly:
.set MBOOT_PAGE_ALIGN, 1<<0
.set MBOOT_MEM_INFO, 1<<1
.set MBOOT_HEADER_MAGIC, 0x1BADB002
.set MBOOT_HEADER_FLAGS, MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO
.set MBOOT_CHECKSUM, -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
(These are multiboot header definitions used by a kernel to get GRUB to load it, for the curious.)I'm sure there are plenty of programmers who just use the shift key if they were to write code similar to the above, but I simply prefer the caps lock key myself. Habit, perhaps.
That is (↓ meaning shift down and ↑ shift up):
↓mboot-page-align↑
The alternative would seem to be less effcient: <Caps>mboot↓-↑page↓-↑align<Caps>This results in, if optimized instead of tripping over my own fingers the entire time: ↓mboot↑↓-p↑↓age↑↓-↑↓align↑
My old iBook capslock key broke in half I hit it so often. I think my pinkies might break in half if I hit the shift keys at that rate!
In Emacs I would end up typing '↑mb↓ M-/ M-/ M-/' (where Meta is the Option key on my keyboard). Because of the way Emacs completes, I might also do '↑mb↓ M-/ M-BS M-BS ↑P↓ M-/'. Either way that's easier to me that typing it out with caps lock or holding the shift key. The only time I can't complete is when I'm defining something for the first time and I'll get over it in that case since it's very rare.
Yes, but you'd agree it's no panacea, surely. - The main code editors I use all have slightly different completion mechanisms. Using a consistent non-IDE editor, while certainly possible, I find much more clunky than making do. I do use the completion of my primary IDE significantly however. - C++ completion is wonky in general due to the poor language grammar - I don't find defining things particularly rare. Every variable (local, member, or otherwise), every function, every class, every macro... - My muscle memory isn't built around the preprocessor, but around much more multi-context languages (such as C++) where entry as terse as yours will generally break regularly.
My mental state is brittle. Mis-completing identifiers breaks my flow and concentration, whereas typing is almost completely subconcious at this point having practiced it so regularly everywhere from this forum to my first clashes with 16-bit DOS programming. This means I could be seen as wasteful from a pure keystroke perspective on just about every front.
Even in the simple act of googling, I start entering my next, more refined search query while still scanning the results of my previous query. Dynamic search results broke this workflow (prompting me to disable Javascript) as my new text would cause the links I tried to click on to disappear because of the additional text entry, causing the results to refresh. I didn't even realize I was doing it until that change.
My use of completion is similar: Type until I scan the refined identifier to select as an early-bail. The closest I get to your completion style is some blind initial 3-5 character tokens + explicit use of completion keywords in some fairly limited contexts where I have a sufficiently low (1-4%?) failure rate. This translates to C-style free functions in C or C++, and C# members of things (classnames generally get typed out and then Ctrl+.ed for "using ...;" statement generation.) My macro names as a rule are too heavily namespace prefixed to blind-complete in that fashion, with the exception of some locally scoped 1-letter #define s which are #undef ed later in the same scope which need no completion.
While I've experimented with acronym-style completion methods rather than start-of-word-only, I find acronyming to require too much conscious thought, and disambiguation gives me outright struggle. If I'm in a context where the completion simply won't work (say that I haven't imported it yet like I thought I did), I have to go back and retype the entire thing.
Alternatively, Sublime Text supports multi-select. Ctrl-F, mboot[^\s]*\b and alt-enter to select all matches. Then use the command palette to convert to uppercase. Or ~ if you are using Vintage. But this isn't as good as autocomplete.
Anyway I have remapped caps and I miss it occasionally when typing constants. Usually I just hold down Shift, or use ~.
As others have pointed out, once you hit a couple of underscores you're not gaining much with the caps lock (if anything), and your editor should be helping you out, here.
At the same time, I'm really not a fan of all caps and underscores, so I probably don't even use constants as much as I should.