
What's the deal with Ctrl+Left and Ctrl+Right? - Siecje
http://www.niladicpodcast.com/blog/2017/1/whats-the-deal-with-ctrlleft-and-ctrlright/
======
FLGMwt
This is one of the most infuriating things about Macs for me. Maybe Vim/Emacs
aside, I've found word jumping and Home/End operations to be absolutely
consistent on Windows, but just about every OSX app seems to have a different
shortcut.

As the author points out, the exact cursor position in some apps is different
on Windows, but he shortcut is always CTRL+{direction}

~~~
m12k
Really? On Mac I've found it very consistent that alt+left/right jumps
forward/back one word, alt+up/down jumps to start/end of paragraph,
cmd+left/right jumps to end of line, cmd+up/down goes to beginning or end of
all text (like Home/End). This is the case for me in Sublime, RubyMine, Xcode,
Firefox, Chrome and any other app I've used in recent years - which apps are
you using that don't follow these conventions?

~~~
colanderman
In Chrome on OS X it differs whether I'm _casting my screen_ or not, whether
Ctrl+←/→ move me to the start/end of a line or document. (I can't figure out
how to move to the end of a line while Chromecasting. It is _beyond_
frustrating.)

~~~
tlb
^e for end-of-line, ^a for beginning-of-line. ^p for previous-line, ^n for
next-line. All far more ergonomic than arrow keys.

~~~
seanp2k2
[http://www.bigsmoke.us/readline/shortcuts](http://www.bigsmoke.us/readline/shortcuts)
they're just GNU Readline shortcuts of copies of those :)

------
Piskvorrr
I don't want _consistent_ behavior everywhere; I want _contextual_ behavior.
In an English text, cursor should stop at different locations than in a
programming language.

In other words, the default algorithm used by a all-purpose editor (Notepad)
is "don't offend too many users too much", not "we know that users are using
this editing control for code, hence movement to underscores".

~~~
monsieurbanana
I think I'd prefer consistent behavior. Contextual behavior would be more
efficient, but it would also take longer to internalize.

I use ctrl+left/right all the time (well actually ctrl+f/b because I use
emacs), and I can't actually tell you where the cursor would stop, but my
fingers do... It's become muscle memory. It would take longer for my fingers
to understand contextual behavior.

~~~
monocasa
Also, what happens when you mix the two, ala comments.

~~~
chipperyman573
Isn't the point of contextual behavior to consider things like that? So it
would act differently in comments.

~~~
monocasa
So my editor starts applying different keyboard shortcuts as I scroll through
the same file?

Yeah, I want distinctly none of that.

~~~
Piskvorrr
And that's the exact reason there are so many text editors to _choose_ from ;)

------
ldp01
This is where I just gave up and just started using Vim plugins wherever
possible.

Edit: He calls out IDEs as a place you can't use Vim. But I think most widely
used IDEs tend to have Vim plugins...

~~~
Spivak
I just wish that Vim plug-ins meant that the IDE would actually embed Vim
inside the IDE and do some vimscript magic to do integration. Vim plug-ins
that just simulate the default Vim keybindings are just sad.

~~~
yoz-y
But some editors do vim integration really well. I was quite amazed when I
discovered that the VS Code vim plugin is actually fully compatible with
multiple cursors.

------
deerpig
"Some of you might be thinking, just use vim or emacs and you don't have to
worry about using Ctrl+Left and Ctrl+Right because there are better ways of
navigation. But you are not always in vim or emacs, sometimes you are in a
browser or an IDE."

Uh, no. I'm pretty much always in Emacs. Except when I'm posting a comment on
HN :)

~~~
DanHulton
What about when you're in shell?

~~~
Spivak
There is never a reason to leave Emacs.

M-x eshell

M-x term

~~~
jacobsenscott
I wish. Every now and then I try and use emacs term. It is slow, doesn't
handle screen resizes well, and God forbid you try and use tmux within emacs
term. You'll be sorry.

~~~
jackewiehose
I prefer M-x shell - simple bash syntax and full emacs editing capabilities.
But it's also painfully slow. Typing ls -l in the wrong directory and I'm
tempted to kill the buffer. On the other hand, this encourages me to use M-x
dired which is way better anyway.

------
jcranberry
I'm mildly suspicious that this article is satire.

It's not that I don't sympathize--I have a personal laptop on Ubuntu, work
computer on OSX from which I sometimes VN into a machine with CentOS, and
using spacemacs means I often context switch between a set of shortcuts which
takes from both emacs and vim. However, I feel that, of the things which need
to be standardized across platforms, the CTRL+* shortcuts really is low
priority.

~~~
mattmanser
If it's one of your primary tools of navigating code without using the mouse,
it's going to be a concern.

For example, in Visual Studio ctrl-x with nothing selected will cut the whole
line, but very few other programs support that. As well as using to move code
around, I use it to delete lines (ctrl-l is better supported, but you can
still do ctrl-x with your hand on the mouse). So when it doesn't work in
Notepad++, it's quite annoying as it breaks your flow. I'm using a plugin to
simulate it, but it's not quite right still.

One of the another thing that can catch you out is that the various MS code
editors behave differently depending on the language you're using, SQL
Management Studio will treat anything wrapped with []s as a single string, but
while in text strings of SQL in Visual Studio it will stop on each bracket. It
end up being quite annoying you can't mark a string in VS as a sql string when
you want to make a small tweak or add an extra column.

It's muscle memory, and so it's going to annoy you when it doesn't work, it
makes you feel clumsy in the new environment.

------
stringham
I had the same problem with vscode.

I filed this issue:
[https://github.com/Microsoft/vscode/issues/32246](https://github.com/Microsoft/vscode/issues/32246)

Rather than wait, I ended up creating this extension last weekend to do it the
way I wanted it to:
[https://marketplace.visualstudio.com/items?itemName=stringha...](https://marketplace.visualstudio.com/items?itemName=stringham.cursor-
move)

------
whipoodle
I like how Sublime does this. On the Mac, if you use Ctrl instead of Option,
it gives you the ability to delete individual words in a camelCase or
snake_case identifier.

~~~
stinos
For the sake of completeness: on Windows and Unix Ctrl goes over entire words
while Alt considers camelCase and under_score.

~~~
Siecje
Are you saying Alt+Left or Alt+Right work? They don't work for me on Windows
or Ubuntu Linux.

~~~
stinos
Strange, works fine here. Dev Channel build 3142 if that matters.

------
gbrown_
I'm at the point we're if I'm typing anything more than a few sentences I'll
write it in Vim and just copy/ paste.

------
tomatsu
Komodo Edit/IDE had some command for selecting the word which is touched by
the cursor (|foo, f|oo, foo| -> would select "foo"). It's similar to double-
clicking a word. I used Ctrl + Shift + Down to activate it.

Too bad it isn't a standard thing. I liked it a lot.

------
rodorgas
I've always thought that Ctrl+Left and Ctrl+Right were borrowed from Emacs M-b
and M-f. Isn't it true? Are there older programs using these key bindings?

------
d--b
Oh, I thought this was a political article with a geeky pun on alt-right and
alt-left...

------
stillbourne
What? Are they out of control?...

~~~
felipellrocha
Maybe we should rebind them to Alt+left, and Alt+Right.

