1
votes

I'm using Atom with soft wrap turned on. In most simple editors such as gedit, Ctrl-Down would be used to skip ahead to the true next line, ignoring any wrapped lines below (same as j and k in Vim).

However in Atom this shortcut produces the result of moving the line itself around, which is less useful to me. I'd like to remap Ctrl-Up and Ctrl-Down to move the cursor up or down to the next true line, as described above.

I'm familiar with editing my keymap file, but I simply can't find any command that would be the equivalent of moving ahead one full line.

2

2 Answers

3
votes

You could write a custom command in your init.coffee like this:

atom.workspaceView.command 'custom:move-next-buffer-line', ->
  editor = atom.workspace.getActiveEditor()
  editor.moveCursorToEndOfLine()
  editor.moveCursorRight()

And then just reverse it for moving to the previous buffer line. You can then map the custom command in your keymap, which you said you're familiar with.

2
votes

If you're using the vim-mode-plus package, then just modify your keymap.cson file by adding

# except insert
# -------------------------
'atom-text-editor.vim-mode-plus:not(.insert-mode)':
  # Motions
  # -------------------------
  'k': 'vim-mode-plus:move-up-screen'
  'j': 'vim-mode-plus:move-down-screen'

See for details https://github.com/t9md/atom-vim-mode-plus/blob/master/keymaps/vim-mode-plus.cson