3

Basically, what I want to achieve is something similar to gnome-terminal -e vim in Linux.

It will launch a vim window and when I quit vim with :q, the window will be closed.

How can I do this with Terminal?

  • Let me give you an up-vote, since two found it clear enough to answer but forgot to up vote you. – Ruskes Dec 1 '18 at 16:15
2

First create a wrapper script for vim:

#! /bin/ksh
#
# vimwrapper
#
#
/usr/bin/vim

Make the script executable- chmod 755 vimwrapper and call the script like this

open -a Terminal.app vimwrapper 
| improve this answer | |
  • Thank you very much for this tip. I never knew I can execute a command directly without passing any options. The only problem I met with this approach is when I do :q to quit it. The terminal window can not be closed. I have to close it manually by mouse. I just want to avoid any mouse click. I can't use cmd+q become that will quit all my terminals. Do you have a workaround? thanks a lot. – sgon00 Dec 2 '18 at 4:03
  • @sgon00- Set the Terminal.app >Preference >Shell >When the shell exits: to Close if the shell exits cleany – fd0 Dec 2 '18 at 12:19
  • Thank you very much! This gave me a big headache! Finally, I can exit to close the shell. THANK YOU! – sgon00 Dec 2 '18 at 13:50
1

You can get something close by using the "New command" entry from the File menu (also accessible through Shift-Cmd-N) to run vim in a dedicated tab/window.

You could also just run the GUI version of MacVim.

| improve this answer | |
  • thanks a lot for the quick reply. MacVim has many problems to me. I just gave it up. And I want to write this into a script, so it's better I can do it in a command line with some arguments.. – sgon00 Dec 1 '18 at 14:28
  • @sgon00 If scriptability is a requirement you probably should add this to the question. – nohillside Dec 1 '18 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .