Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

does someone know how to open a new terminal window when opening a new text with VIM.

I would like to have an autarchic window which can be resized and closed while the other windows will stay as and where they are.

Regards

mmm...

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

You could simply use MacVIM to handle this. When you install MacVIM it should give you an option to install the command line shortcuts.

Then, in your Terminal, simply use mvim instead of vi:

mvim /path/to/your/file.txt

Or, if you are super lazy, add this to your ~/.profile:

alias vi=mvim

This also allows you to associate text files with MacVIM in finder, so you always get the right application for your files, weather you open them in the GUI or not.

share|improve this answer
    
Bear in mind that this only opens a new macvim window not a new terminal window. –  RobZolkos Apr 29 '11 at 9:08
    
Quite true. Thanks for pointing it out. –  Jack M. Apr 29 '11 at 15:50
add comment

You could write a little script like this :

#!/bin/sh
osascript <<END
tell app "Terminal" to do script "vim"
END

Name this script v and make it executable :

chmod +x v

Then when you're in terminal, just execute the v script and it will open a new terminal window and run vim.

Alternatively, if you want to open a text file as part of this:

#!/usr/bin/osascript
on run argv
  tell app "Terminal" to do script "vim " & item 1 of argv
end run

Then just run v text.txt and it will open a new terminal window, open vim, and open the text file called text.txt. If text.txt doesn't exist, as usual, vim will create it in the buffer.

share|improve this answer
    
THX. At least it should open the text file i pointed at. –  MartinVonMartinsgrün Apr 27 '11 at 8:51
    
I updated my answer to allow you to open a text file pointed at the script with vim. –  RobZolkos Apr 27 '11 at 9:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.