Can I pass values to keybinding commands?


I’m trying out Atom to see if I want to move from Sublime or not, and it looks good sofar, but I’m running into a problem with setting up my key bindings.

In Sublime I can hold ctrl and press down, for example, and it will move my cursor(s) down by 10 lines instead of the normal 1 that is set for just pressing down on it’s own.

This is of course a custom key binding as I find it useful to quickl;y scroll up and down files.

In Atom I can set a key binding as follows:
‘ctrl-down’: ‘core:move-down’

But this will only move the cursor by 1 line.
Is there a way to pass this command a value, like 10, to tell it to move 10 lines instead of 1?


No, it is not possible to pass values to a keybinding. You can make your own command though, and make a keybinding for that command. It would look something like this (put it in your

atom.commands.add 'atom-text-editor', 'editor:move-10-lines-down', ->
  textEditor = atom.workspace.getActiveTextEditor()
  cursorPosition = textEditor.getCursorScreenPosition()
  newCursorPosition = cursorPosition.translate([10,0])

and then add a keybinding for the editor:move-10-lines-down command.


There is also the block-travel package.


Thank you both for your replies.
I think I will go with the custom commands option, since it seems easy enough.