MacOS – How to create Mac OS X global hot key to open .txt file in MacVim.app at vim ‘mark’

applescriptautomatormacosmacvimshortcut-menu

Can and how can I create Mac OS X global hot key (possibly mapped to an OS X service, like what OmniFocus and Fantastical offer to make new entries in their inbox/calendar, respectively) to open a specific .txt file in MacVim.app at a specific vim mark?

I suspect I can use Automator/AppleScript or some such in combination with vim's "global" marks to accomplish this, but uncertain.

Best Answer

Two possibilities are Keyboard Maestro or Alfred. Keyboard Maestro will set a global keyboard shortcut.

I assume there is a command-line utility for MacVim like there is for BBEdit and if it can open at a specific ‘vim mark’. For example, BBEdit’s command is called bbedit and cal open a specific line number using “:xy” where “xy” is the line number. You could make a Keyboard Maestro shortcut that will open a specific file using this command

/usr/local/bin/bbedit /path/to/filename:33