
Set the "replaces selected text" checkbox.
Create a new "Contextual Workflow" (Quick Action). Under "Profile"->"Shell" set "When the shell exits" to "Close window". This profile will be used when a new VIM window is opened, adapt it to your liking. Under "Profile" add a new profile called vim using the +button. How to use (Automator) Prepare Terminal.app Set available in "Services" and "Finder". Copy-Paste the text of open-file-in-vim.applescript to the Applescript action. Add a "Stop and Return script result" Action. Copy-Paste the text of edit-text-in-vim.applescript to the Applescript action. Installation should work similar to below. They allow you to create Quick Actions to edit text files or text snippets in the VIM command-line editor. These Applescript files can be used with the Shortcuts or Automator application on MacOSX.
your applescript and change the file format to application, resulting in RunKeepass.Applescript files to create Automator actions invoking VIM in Terminal.app What is this? Save your applescript as filename.scpt, in my case RunKeepass.scpt
with administrative privileges - declares you want to run as an admin. "" - replace with your password (keeping quotes) ex "mypass". password - declares to applescript your password. " - replace with your username (keeping quotes) ex "josh". user name - declares to applescript you want to run the command as a specific user. " - this is your shell script (full path) created in step one (you can also run direct commands, I could omit the shell script and just run my mono command here) do shell script - applescript command to call external shell commands. Open AppleScript Editor, and call the shell scriptĭo shell script "sh /Volumes/Media/~Users/me/Software/StartKeepass.sh" user name "" password "" with administrator privileges Save shell script, for my example "StartKeepass.sh" (this runs the w32 executable, using the mono framework) Mono "/Volumes/Media/~Users/me/Software/keepass/keepass.exe" Shell ScriptĬreate your shell script in your favorite text editor, for example: As joe mentioned, creating the shell script and then creating an applescript script to call the shell script, will accomplish this, and is quite handy.