Reputation: 1660
I want to override alt+up in atom in order to move lines up in this way. But when I try to do it in keymap.cson I get error, because of duplicate key bindings. So I search what else this combination do and I find that it is native command and its selector is "body .native-key-bindings".
I tried this:
'atom-workspace atom-text-editor:not([mini])':
'alt-down': 'editor:move-line-down'
'atom-workspace atom-text-editor:not([mini])':
'alt-up': 'editor:move-line-up'
So I don't know how to make my key-bindings in way that alt+up move the current line uphill.
Upvotes: 0
Views: 629
Reputation: 56508
Something like this in keymap.cson should do it:
'atom-text-editor:not([mini])':
'alt-up': 'editor:move-line-up'
'alt-down': 'editor:move-line-down'
Given what you said you had tried, I think the issue may have been including atom-workspace
in the selector. That selector is very broad, covering everything in your Atom window. The text editor pane, any other input panes such as the find pane, your tabs, status bar, the file tree view, and anything else in the window.
For this keymap you only really care about the main text editing panes. The atom-text-editor:not([mini])
selector should give you that. It will match only on the main text editing windows. The :not([mini])
qualifier will exclude the mini inputs (such as the one-line inputs used in the find panels, the ShiftCmdP command palette, etc).
Upvotes: 2