A custom gutter widget

I would like to create a code mirror helper / widget that will mimic the medium.com UX behavior of helping new users see what commands are available in custom language.

Upon the user hitting enter and getting to a new line I would like circle with + or some other icon to appear in the gutter area and when the user clicks it to open some div menu with example commands, when the user picks a command it’s full text will be entered into the document in the current pos.

What’s the best way to do that?