ttscoff / nv

MultiMarkdown version of Notational Velocity with Markdown editing features and preview
http://brettterpstra.com/projects/nvalt
BSD 3-Clause "New" or "Revised" License
1.78k stars 197 forks source link

How to add new commands? #480

Open dbieber opened 7 years ago

dbieber commented 7 years ago

I'm looking through the source to see if I can figure out how to add additional keyboard shortcuts. I figured I'd also ask here, in case that turns out to be a faster method of onboarding.

So far I've found setupFontMenu in LinkingEditor.m, but adding a new MenuItem like strikethrough hasn't worked for me (maybe because of validateMenuItem(?)).

https://github.com/ttscoff/nv/blob/a863e96a5bc2ed2723fd6d0beb479c50a7f299f7/LinkingEditor.m#L1655-L1657

I've also just found MainMenu.xib, which looks promising.

dbieber commented 7 years ago

Update: Yes, MainMenu.xib was the right place to add new commands. I was able to add new menu items here, give them Key Equivalents, and then associate their "actions" with new functions I defined in AppController.{h,m}.