Tip #1500: By default, when opening files in Mac OS X, a new vim window is opened. This shows you how to have only one window.
tip karma |
Rating 10/19, Viewed by 5294
|
Read and edit this tip on the
Vim tip wiki.
The wiki may have a more recent version of this tip.
created: |
|
February 1, 2007 13:36 |
|
complexity: |
|
intermediate |
author: |
|
edit in a single window in Mac OS X |
|
as of Vim: |
|
|
This tip shows you how to make an applescript file, and how to use it so you can open files from the command line in the same window.
make a file called gvim.scpt (for example)
on run argv
tell application "Vim"
set theUnixPath to item 1 of argv
set theMacPath to (POSIX file theUnixPath) as string
open file theMacPath
activate
end tell
end run
What this does, is give a command to the vim carbon application to open a file.
make another file (the launcher). I call it "g" (shorter to type) and put it somewhere in your path.
#!/bin/bash
osascript /path/to/gvim.scpt $*
What this doesn't do yet: create the files automatically if they do not exist.
<< Jump back to spell checked words |
substitute last search >>
Additional Notes
|