Search code examples
contextmenubookmarksatom-editor

Add Context Menu command in Atom.io


I'm trying to add a context menu command to the Atom editor so that I can easily toggle bookmarks. I added the following to my config.cson file:

"context-menu":
  "atom-text-editor":
    Bookmark: "bookmarks:toggle-bookmark"

I restarted Atom and right-clicked on a line of code, but the context menu hadn't changed. Is there something else that I have to do? (I've tried Atom on Windows 7 and Ubuntu 14, but neither update the context menu.)


Solution

  • Add this to your init.coffee file:

        atom.contextMenu.add {
        'atom-text-editor': [{
            label: 'Bookmark',
            command: 'my-package:toggle'
        }]
    }