Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Launch Vim from any text widget UNIX
Stuff you'll need for this hint:Now, put them together. TextExtras allows you to run the text in an entry box through a pipe and replace the text with the pipe's output. We're going to set up a pipe for Vim. The tricky part is that Vim, being an editor, can't just read text from stdin, edit it, and write it back to stdout; it uses stdout for the editing interface. So we have to help it out a bit, and this is where vimwrapper.pl comes in.

Read the rest of the article for the details on this trick...


You'll need to edit vimwrapper.pl a little bit, to tell it where your copy of Vim is installed. You might also want to add options to its list. At any rate, modify it as needed and drop it somewhere useful; I put mine in ~/bin/.

Okay, now test it... the way it should work is when you pipe text into vimwrapper.pl on stdin, it should launch Vim with that text in the buffer. You edit the buffer, and when you quit Vim your modified text is dumped back to stdout. So you can test it with "echo 'some junk' | ~/bin/vimwrapper.pl".

If all goes according to plan, you'll want to define a 'User Pipe' for vimwrapper.pl in TextExtras. That TEUserPipes.plist file does this: it both defines the pipe to ~/bin/vimwrapper.pl and binds it to the "CMD-\" keystroke. Move that file to ~/.TEUserpipes.plist. You should be good to go at this point. Fire up TextEdit and give it a go.

This trick-- with a little modification of the supplied script -- should actually work for any editor you might wish to use (even emacs, I suppose).

NB: TextExtras does not get loaded in Mozilla. I don't know why, exactly.

[Editor's note: I'll display my complete lack of knowledge here by stating that I have close to no idea what this hint does, but boy, it sounds cool! Obviously, I have not tried this hint on my system ;-)!]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[6,206 views]  

Launch Vim from any text widget | 4 comments | Create New Account
Click here to return to the 'Launch Vim from any text widget' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
update
Authored by: logan on Jan 22, '02 12:06:33PM
It seems the currently available disk image at Benji's Vim site is corrupted. I'm posting a temporary mirror of the older version I'm using (6.0.93 as opposed to 6.0.131) at http://homepage.mac.com/lwj/macosx/TEVim/vim6.0.93.dmg.gz until I hear back from him.

My apologies for any wasted bandwidth.

[ Reply to This | # ]

update
Authored by: ret on Jan 22, '02 09:44:02PM

Did you get Finder crashing when you attempted to open it too? Downloading from the iDisk HTML link produced this corrupt 400K file, rather than the expected 3.0MB. However, using iTools to mount a user's public folder on your desktop and copying from there worked a treat. So you can use this method to get the latest version if you prefer.

Like robg, I'm not convinced I know what the hinter is on about. But I'm guessing it means you can use vim to edit text through Services, rather than cutting and pasting via a side-trip to the terminal. I'm hoping that's what it means, 'cos I could use that ;-)

cheers
RET



[ Reply to This | # ]
...and furthermore...
Authored by: ret on Jan 24, '02 12:28:03AM

You also need Mike Ferris' MOKit installed (TextExtras won't function without it) You can find it at the same site (click the "back to FreeStuff" link to find it)

RET



[ Reply to This | # ]
Launch Vim from any text widget
Authored by: jacobolus on Jan 09, '06 06:37:32PM

It doesn't work in Mozilla because Mozilla doesn't use cocoa text widgets.



[ Reply to This | # ]