1. Install py-appscript ( 
http://appscript.sourceforge.net/py-appscript/index.html
) . In macports: sudo port install py25-appscript

2. Create the file "mvim":
-- BEGIN --
#!/usr/bin/env python

import sys
import os.path

from appscript import app
from appscript import mactypes
from appscript import k

if __name__ == '__main__':
    macvim = app("MacVim")

    args = sys.argv[1:]
    if not args:
        args = [""]

    for arg in args:
        f = mactypes.File(os.path.abspath(arg))
        macvim.open(f)

    macvim.activate()
-- END --

NB: I've been trying to make a common applescript, but i don't know
how to get absolute path of arguments in a terminal :-( . It works
with arguments, which has absolute path. For instance, mvim ~/
Documents/test.txt
-- BEGIN --
on run argv
        repeat with arg in argv
                set a to POSIX file arg
                tell application "MacVim" to open a
        end repeat
        set doc_len to count of argv
        if doc_len = 0 then
                tell application "MacVim" to open ""
        end if

        tell application "MacVim" to activate
end run
-- END --



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_mac" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to