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

mvim alternate -- Open files by drag-n-drop in Terminal vim

Expand Messages
  • Bee
    Open files by drag-n-drop in the Terminal version of vim The following AppleScript enables me to open files by drag-n-drop with the Terminal version of vim.
    Message 1 of 1 , Mar 7, 2010
    • 0 Attachment
      Open files by drag-n-drop in the Terminal version of vim

      The following AppleScript enables me to open files by drag-n-drop with
      the Terminal version of vim.

      Copy the script to a "Script Editor" window and save as an
      "application".

      Edit "myVim" to point to the version of vim you want to use in
      terminal. The following should work for the default install of MacVim:

      set myVim to "/Applications/MacVim.app/Contents/MacOS/Vim"

      I added the resulting AppleScript application to the Dock and the
      Desktop, making it easy to open files by drag-n-drop in the Terminal
      version of vim.

      -Bill

      --==============================================================
      -- Open files by drag-n-drop in the Terminal version of vim

      on vim(miv)
      --
      set myVim to "/Applications/MacVim.app/Contents/MacOS/Vim"
      --
      tell application "Terminal"
      activate
      do script myVim & miv
      end tell
      end vim

      on open theDrop
      set miv to ""
      repeat with aFile in theDrop
      set aFile to POSIX path of aFile
      set miv to miv & " " & quoted form of aFile
      end repeat
      vim(miv)
      end open

      on run
      vim("")
      end run
      --==============================================================

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.