I wonder if a lot of people rebind the underscore character to a more convenient key?
I wonder if a lot of people rebind the underscore character to a more convenient key?
But having to press shift for a capitalised word is not a pain. OK, sounds about right.
Another consideration: whether the program you're typing in will stop at underscores or hyphens when using Ctrl + Shift + Left/Right Arrow when highlighting. If I want to highlight `this_variable_with_a_long_name` without using the mouse, it's going to be a pain if I have to hit the left arrow key six times instead of once. (Frustratingly, it varies from editor to editor.)
x-y = ‘a string or something’
#
# bunch of lines of code here
#
x = 5
y = 2
assert x-y == 3As far as keyboard navigation around partial or whole words, I find it really helpful to have separate keybindings. For me (on a Mac so keyboard layouts matter), opt+left/right moves a “whole word” (as in to the nearest non-word character) and ctrl+left/right moves to the nearest internal word boundary (where boundary is mostly arbitrary; in bouncyCase it moves to the nearest non contiguous case change, in any-punctuated_case it moves to the nearest punctuation).
Agree it’s frustrating how much this varies by editor, but being able to configure the behavior is one of my first checks when deciding if I’ll use the editor at all.
Many years ago, I was programming in COBOL, where kebab-case is the norm. For a while there I was programming in both "C" AND in COBOL. That was a nightmare, I invariably used the wrong syntax for my variable-names, as both languages used incompatible syntax for those variable-names.
But yeah kebab-case-might-be-easier than camelCaseToRead in the long run.
and it’s also quite far from the home row on the keyboard.
I'm not going to adopt a coding style that requires me to reach that far repeatedly for every name.
Code is written once but read many times. Better to optimize for reading than writing.
If you're really perverse you can do the same for 9/( and 0/), because most programmers type parens way more often than the type 9 or 0.
Also.dot.case.wins.all.
Maybe when defining a new variable/class/etc. the first time, then IDE autocomplete fills it in the next.
I create bindings using Karabiner (Mac) for all symbols so that I don’t have to press Shift or leave the home position.
Underscore is “s comma”.