tags:

views:

44

answers:

3

How do you open up vim from a CLI like svn and git do when you drop -m from commit commands?

I'm getting the follow error: Vim: Warning: Output is not to a terminal

`echo "Please edit this file" > file.name`;
`vim file.name`;
A: 

EDIT:

I just realized it sounds like you already have this set up for svn/git... what are you trying to open it from?


for bash: export SVN_EDITOR=vim although EDITOR will work as well, though this will influence other things as well. IF for some reason vim isnt on your path youll need to use the full path as well. Place this in your .profile or .bash_profile.

prodigitalson
Trying to write a php script to open vim in a similar manner.
Logan Bailey
+1  A: 

PHP Doesn't automatically pass thru the STDIN/STDOUT streams, you need to do it manually:

`echo "Please edit this file" > file.name`;
system("vim file.name > `tty`");

(Note: I don't really understand what I'm talking about, I just know the above works.)

too much php
hahaha... love your note.
prodigitalson
This worked great. Had some issues with it though, since you were changing the output buffer system returns automatically to the PHP script before you exit vim. I changed it to exec(); which is the same as ``. And that prevented the hanging.
Logan Bailey
+1  A: 

This doesn't really answer your question, but I couldn't resist. PHP is more or less fine when it comes to web applications but it's a terrible choice when it comes to CLI scripting. Start with Bash for simple tasks and move to Perl/Python once it gets more complex.

Adam Byrtek