Can't override native! keybinding (alt-down)


#1

Hello, I guess my screenshot will be self-explanatory:

I want to set alt-down to move a line down…


#2

Where’s your cursor in all this? None of the available options are getting selected, which suggests that no viable element is in focus.

You should just move all of those bindings under 'atom-text-editor:not([mini])'.


#3

I tried with setting my cursor to different lines and firing the shortcut (alt-down) - nothing happened - but it always seems that “native!” comes first in priority.


#4

See the X, though? That indicates that the binding is not matched with anything in the element(s) associated with the event. When the selector matches an element, there will be a checkmark.

That’s why I think you should simplify your selectors. If you don’t need specificity, it’s a distraction and an extra set of variables.


#5

I just tested the following:

'atom-text-editor':
  'alt-down': 'editor:move-line-down'

It worked great.


#6

I think I figured what the problem is (still dont know how to fix it)
it conflicts with ctrl-alt-down (which I use for duplicating a line)
the last one to appear in the file takes precedence and ‘disables’ the other. (like CSS I guess)
Any tips?


#7

This

    'atom-workspace atom-text-editor:not([mini])':
        'alt-up': 'editor:move-line-up'
        'ctrl-alt-down': 'editor:duplicate-lines'
        'alt-down': 'editor:move-line-down'

worked. But I must say guys, I did plenty of googling to find solid examples of keymap cson files and how to do stuff, in vain… And I’m a front-end developer - so I get pretty well how selectors work. There’s definite need for solid documentation and examples of how this works. Also I think keymap and keybinding are used to describe the same thing, makes it hard to research for stuff.


#8

No, it didn’t work. Still, its’ either ctrl-alt-down or alt-down depending on the order of appearance in the file.


#9

There is solid documentation on this site. No need to Google for it.

I’m confused about the other issue. alt-down and ctrl-alt-down should not be in conflict. Mind posting shots of the keybinding resolver?


#10

Alt+Ctrl+Down isn’t conflicting with Alt+Down, you have two keys that are identical. See the warning box in the “Configuring with CSON” section of the Atom Flight Manual here:

http://flight-manual.atom.io/using-atom/sections/basic-customization/#configuring-with-cson