|
|
Use Terminal's vi as default text editor
I tend to use iTerm instead of Terminal, so I modified the script a bit so it works in iTerm. This will also deal with multiple files (opens a new tab for each), and it will also leave you in the same directory where the opened text file resides:
-Chrison run set this_inputfile to "" set this_inputfiledir to "~/Desktop" my launchVI(this_inputfile, this_inputfiledir) end run on open inputfiles repeat with this_inputfile in inputfiles tell application "Finder" set this_inputfiledir to quoted form of POSIX path of (container of this_inputfile as string) end tell my launchVI(this_inputfile, this_inputfiledir) end repeat end open on launchVI(this_inputfile, this_inputfiledir) tell application "iTerm" activate tell the first terminal set mySession to (make new session at the end of sessions) tell mySession set short_name to system attribute "USER" exec command "login -fp " & short_name if this_inputfile ≠ "" then write text "cd " & this_inputfiledir write text "vi " & quoted form of POSIX path of this_inputfile & return else write text "cd " & this_inputfiledir write text "vi" end if end tell end tell end tell end launchVI
Use Terminal's vi as default text editor
Ooh, this is nice. I'm thrilled that my first hint submission has gone so well. Maybe I'll do more :)
Use Terminal's vi as default text editor
Awesome tip, Chris! One of the best on this site! |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.15 seconds |
|