Word boundary does not apply for programming language (ctrl-left, ctrl-right)


Hi, the issue I have is with ctrl-left, ctrl-right and all things related.
By default ctrl-right is binded to editor:move-to-end-of-word, but it does not work well for programming languages where lot of spaces and indents are used.
An example

on') ->a
12345678 (numbers to refer to cursor position)

On the code above when I go right, my cursor stops after char 2, 4 and 7, but when going backwards (to the left) it stops at position 7, 5, and 2. The problem here is that depends on the direction I go - when going left and right, I have different “stops”.

I would like Atom to stop for each boundary (end of the word and start of the word), does not matter what direction I’m going. So In my example, always stop at 2,4,5 and 7. is it possible to do in Atom?

In other words - is there a function like editor:move-forward-to-word-boundary and editor:move-backward-to-word-boundary. I mean any boundary, start or stop one.

I will be appreciate for your advises


Hi @atay,

There are editor:move-to-next-word-boundary and editor:move-to-previous-word-boundary commands and also similar commands for selection. From what I can see these are not bound by default in Atom so you will have to edit your keymap.cson to access them. These commands also exist with subword boundary variants.

  'ctrl-right': 'editor:move-to-next-word-boundary'
  'ctrl-left': 'editor:move-to-previous-word-boundary'
  'ctrl-shift-right': 'editor:select-to-next-word-boundary'
  'ctrl-shift-left': 'editor:select-to-previous-word-boundary'


Thanks a lot, that’s what I expected! There are just missing two more shortcuts, so I add them here if someone wants to use it as well.

  'ctrl-delete': 'editor:delete-to-next-word-boundary'
  'ctrl-backspace': 'editor:delete-to-previous-word-boundary'