1

I have been trying to rid myself of the bad habit of key-chording in Emacs using only one hand. That is, for C-x I want to use my right pinky to hit the right-Ctrl and a left-hand finger to hit x. My question is how do I type efficiently in all caps? For example, when I type an environment variable such as RAILS_ENV=test it's very tedious to switch between left and right hands holding Shift every time the key falls on the opposite side of the keyboard. It would seem that this is an ideal case for using CapsLk, but I've long remapped that key to Ctrl because of the scarcity of its use and potential for accidental triggering.

I found this related question but it deals more with enforcing the habit than the question of how to actually type efficiently using the opposite hand to hit modifier keys.

Community
  • 1
  • 1
Reed G. Law
  • 3,897
  • 1
  • 41
  • 78
  • 3
    Type `rails_env` in lower case, then use a predefined key to uppercase the preceding word. – chepner Jan 22 '14 at 13:22
  • @chepner brilliant! It seems bash knows emacs' `M-u` (upcase-word). So I can type `rails_env` and then `C-a` `M-u`. – Reed G. Law Jan 22 '14 at 13:50
  • You can also use `M-b` instead of `C-a` to uppercase any word, not just the first word of the line. – chepner Jan 22 '14 at 13:52
  • 2
    You can also use prefix arguments before `upcase-word`, e.g., `ESC -1 M-u` will upcase the word immediately before `point`. Inside Emacs, `C-u` is an alternative to `ESC`. – Thomas Jan 22 '14 at 13:55
  • Yes, `M-b` is good for moving back one word, but usually environment variables in all caps go at the beginning or end of a line. – Reed G. Law Jan 22 '14 at 13:56
  • If your need for multiple chars in a row being uppercase is truly rare, as you claim, then the problem you pose here should be equally rare. My guess is that neither is as rare as you think. Instead of "using a predefined key to uppercase the preceding word", just liberate the caps-lock key to let it do its job. Then use it -- when this "rare" case presents itself. – Drew Jan 22 '14 at 14:43
  • I feel toggling caps-lock on and off is equally tedious. Caps-lock seems like a relic from typewriters since computers can easily toggle the case of regions of text. – Reed G. Law Jan 22 '14 at 16:46

2 Answers2

3

As the question appears to be targeted towards bash command lines, you can use Control-A Meta-U to capitalize the first word of the line, useful for typing

env_var=value some_command ...

prior to converting it to

ENV_VAR=value some_command ...
chepner
  • 497,756
  • 71
  • 530
  • 681
1

Instead of making CAPS LOCK an additional CTRL, you could simply swap CAPS LOCK and LEFT CTRL.

Thomas
  • 17,016
  • 4
  • 46
  • 70
  • While that may make reaching the left-Ctrl easier, I would still have to reach the more-problematic right-Ctrl when chording with the left hand. But that's slightly off-topic because my question was about using Shift to type in all caps. That question was answered well in a comment by @chepner. I wish there was a way to promote a comment to an answer so it can be marked correct. – Reed G. Law Jan 22 '14 at 13:54
  • My point was that if you *swap* the two key bindings, you have a CAPS_LOCK at your disposal if you want to write all-upper-case words, while still having LEFT CTRL in a more comfy location. – Thomas Jan 22 '14 at 13:57
  • That's true, but to me there's some value in the symmetry of Ctrl keys when using the correct hands to hit modifier keys. I think mapping left Ctrl to CapsLk is more necessary for those who use the same hand to chord. – Reed G. Law Jan 22 '14 at 16:58
  • But didn't you say you mapped CAPS_LOCK to CTRL? How is that symmetric to the right side of the keyboard? Are you using both the CAPS_LOCK key and the original CTRL key (both for CTRL)? – Thomas Jan 22 '14 at 17:11
  • Yes, both CAPS_LOCK and LEFT CTRL are mapped to CTRL. Sorry I didn't make that clearer. – Reed G. Law Jan 22 '14 at 18:29
  • Why did you map `CAPS_LOCK` to `CTRL` if symmetry is so important to you? – Thomas Jan 24 '14 at 12:54
  • The CAPS_LOCK key has a tendency to get accidentally triggered causing undesired capitalization. Perhaps mapping it to ENTER would make sense, but I'm mainly concerned with the keys that are used in combination such as SHIFT, CTRL, and META. – Reed G. Law Jan 24 '14 at 17:29