Loading ...
Sorry, an error occurred while loading the content.

Re: Python script for executing mvim from a terminal. (Only MacVim Snapshot >= 37)

Expand Messages
  • Dan Shumaker
    the mvim script that comes with MacVim supplies command line parameters correctly to MacVim. for example if you wanted to use the -S ( for a session file) or
    Message 1 of 3 , Feb 27, 2009
    • 0 Attachment
      the mvim script that comes with MacVim supplies command line parameters correctly to MacVim.

      for example if you wanted to use the "-S" ( for a session file) or "+TagList" as command line parameters to MacVim, it wouldn't work.

      But supplying those parameters to the mvim script does work.

          -d

      Matt Tolton wrote:
      How are these different from just doing 'open -a MacVim foo1.txt foo2.txt'?
      
      On Thu, Feb 26, 2009 at 11:22 PM, pitman <Konstantin.Lepa@...> wrote:
        
      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
      -~----------~----~----~----~------~----~------~--~---

    Your message has been successfully submitted and would be delivered to recipients shortly.