Sysrq147
Sysrq147

Reputation: 1367

Atom IDE - Keybinding

I have disabled the default Atom IDE keybinding for the combination alt + f (In my keymap.cson):

'atom-text-editor':
  'alt-f': 'unset!'

How to make it to show [ character when I click alt + f?

Upvotes: 1

Views: 686

Answers (1)

nwinkler
nwinkler

Reputation: 54517

Here's how to do this, based on this forum entry:

  • Open the editor's init.coffee script file (Menu: Atom > Init Script...)
  • Insert the following text (make sure to use the right indentation:

    atom.commands.add 'atom-text-editor',
      'custom:insert-bracket': ->
        atom.workspace.getActiveTextEditor()?.insertText('[')
    
  • Save the file.

  • Open the keybinding file (Menu: Atom > Keymap...)
  • Add the following mapping (replacing yours) to call the new command:

    'atom-text-editor':
      'alt-f': 'custom:insert-bracket'
    
  • Save the file.

  • As a last step, restart Atom.

This worked for me, pressing Alt+f now inserts an opening bracket (which is automatically completed with a closing bracket by Atom).

Upvotes: 1

Related Questions