?

Log in

No account? Create an account
open a text file in vi from the Finder in Mac OS X - badgerblog
March 18th, 2012
11:29 am

[Link]

Previous Entry Share Next Entry
open a text file in vi from the Finder in Mac OS X


* One approach for all text files:
http://stackoverflow.com/questions/5152527/how-to-add-command-action-to-open-with-on-os-x

* A simpler way (than the Cocoa app in that first link) to add to the
often-forgotten OS X Finder Services submenu.

http://peterdowns.com/posts/open-iterm-finder-service.html

* My approach for a desktop shortcut for a specific file: This is brittle in that it's tied to a single file and you must edit the shortcut to change the file (or exit vi and cd around, in which case having the Terminal in the Dock may be a good solution).

1. Create a text file named "launchtextfile" containing the following:

/usr/bin/vi /Users/username/Desktop/whatever.txt

(Nice trick OS X added in 10.2?: drag any file into a terminal window to see
the absolute path to that file.)

2. In the Finder, select the file and File > Get Info.

In the "Open with" section, select Applications/Utilities/Terminal.

3. From a command line, chmod +x launchtextfile.

Double-click launchtextfile to open a terminal window displaying the file open
in vi.

Tags:

(Leave a comment)

Surrounded By Skulls and Spiders Powered by LiveJournal.com