Set shortcut in Atom editor for Go To Definition using go-plus

How to set a shortcut in the Atom editor for Go To Definition using go-plus. Thank you for your help.

+7
atom editor
source share
1 answer

By default, the go-plus package uses Alt + Cmd + G to invoke the Go To Definition binding (as you can see here ). This linking will only work in files that use Go grammar. Since Cmd is only available on Mac OS X, I don’t know what other operating systems will use by default.

To override key bindings, follow these steps:

  • Open "Atom Settings", select the "Binding Keys" section.
  • In the Search field, enter "go" to filter the list of key bindings.
  • Click the Copy icon next to the golang:godef .
  • Click the link to the link in the key line at the top.

Subscriber bindings

This will open your keymap.cson file. Go to the end of the file and paste the copied content:

 'atom-text-editor[data-grammar="source go"]:not(.mini)': 'alt-cmd-g': 'golang:godef' 

Edit the key binding to your liking and save the file.

To test a new key binding, open the Play Key Binding window by selecting Packages> Key Binding Switch> Toggle. Open the Go file and click the button you have assigned, and then view the Key Binding Resolver view to see the conflicts.

+15
source share

All Articles