How to add custom key binding for autocomplete confirm


#1

Hi!

I would like to add the following custom key bindings to my Atom Editor.

  • ctrl-j for insert newline
  • ctrl-j for confirm for autocomplete.

I managed to add insert newline key binding by adding the below code to my keymap.cson file:

'atom-text-editor:not([mini])':
  'ctrl-j': 'editor:newline'

I tried to add confirm for autocomplete as well, but couldn’t find the right one. The action I want to copy is done by enter. Attached a screenshot for autocomplete what I am talking about here. How can I add it? Thanks!


Adding a new keybinding
#2

The command is autocomplete-plus:activate.


#3

@DamnedScholar Thank you for your reply! Thanks to your advice, I managed to add ctrl-j key binding to both inserting newline and confirming autocomplete with the following.

'atom-text-editor:not([mini])':
  'ctrl-j': 'editor:newline'

'atom-text-editor:not([mini]).autocomplete-active':
  'ctrl-j': 'autocomplete-plus:confirm'

Thank you so much for your help!


#4

No problem. :slight_smile: