Only taking the last configuration at keymap.cson


#1

This works:

    'atom-workspace atom-text-editor:not([mini])':'ctrl-i':
  'editor:indent-selected-rows'

and line comment shows cntr-i o indent, but if I add the oudent configuration (ctrl-shift-i) like this:

'atom-workspace atom-text-editor:not([mini])':'ctrl-i':
  'editor:indent-selected-rows'


'atom-workspace atom-text-editor:not([mini])':'ctrl-shift-i':
 'editor:outdent-selected-rows'

Then, indent became the defaut: ctrl+] and only work outdent ctrl-shift-i

If I switch the order, then indent works, bu outdent doesn’t…
What I’m doing wrong? HELP.


#2

I have been caught by this problem many times. You are specifying duplicate keys for a javascript object. The first key is being replaced by the second. Put the items for that key together under a single instance of the key.


#3

How?
Not working:

'atom-workspace atom-text-editor:not([mini])':
'ctrl-i':'editor:indent-selected-rows'
'ctrl-shift-i':'editor:outdent-selected-rows'
'ctrl-d': 'editor:toggle-line-comments'

Neither:

'atom-workspace atom-text-editor:not([mini])':
'ctrl-i':'editor:indent-selected-rows',
'ctrl-shift-i':'editor:outdent-selected-rows',
'ctrl-d': 'editor:toggle-line-comments';

Nor:

'atom-workspace atom-text-editor:not([mini])':
'ctrl-i':'editor:indent-selected-rows':
'ctrl-shift-i':'editor:outdent-selected-rows':
'ctrl-d': 'editor:toggle-line-comments'

I ran out of ideas…


#4

Well, if I read a little more about Coffe script object notation…

This works:
Please note the indentation.

  'atom-workspace':
      'ctrl-i':'editor:indent-selected-rows':
      'ctrl-shift-i':'editor:outdent-selected-rows':
      'ctrl-d': 'editor:toggle-line-comments'

I personally hate when something depends upon indentation… ¬_¬


#5

I think you can also use a keymap.json where you can remove the indentation:

{
"atom-workspace": {
"ctrl-i": "editor:indent-selected-rows",
"ctrl-shift-i": "..."
}
}

#6

This is covered by the FAQ:

I need to rewrite it to be more general.