tags:

views:

170

answers:

3

I am writing an editor which has lot of parameters that could be easily interacted with through text. I find it inconvenient to implement a separate text-editor or lots of UI code for every little parameter. Usual buttons, boxes and gadgets would be burdensome and clumsy. I'd much rather let user interact with those parameters through vim.

The preferable way for me would be to get editor open vim with my text buffer. Then, when one would save the text buffer in vim, my editor would get notified from that and update it's view.

+2  A: 

Check out It's All Text!. It's a Firefox add-in that does something similar for textareas on web pages, except the editor in question is configurable.

Hank Gay
I <3 it's all text.
rampion
+6  A: 

Write your intermediate results (what you want the user to edit) to a temp file. Then use the $EDITOR environment variable in a system call to make the user edit the temp file, and read the results when the process finishes.

This lets users configure which editor they want to use in a pseudo-standard fashion.

rampion
I haven't looked into the details of It's All Text! but that's pretty much what it does, right? It's what I came up with one day when I tried to work out how I'd solve the problem.
Hank Gay
Pretty much, except instead of waiting for the editor to finish, it monitors the file for update, which is slightly more robust.
rampion
+1  A: 

You can also think about integrating VIM in to your app. Pida does this

Nick Stinemates