Feature Request - HTML Preview

7 views
Skip to first unread message

Poorly

unread,
Nov 13, 2007, 11:24:04 PM11/13/07
to vim_mac
Hi All,

Whilst reading the list of Mac Apps that use WebKit at
http://trac.webkit.org/projects/webkit/wiki/Applications%20using%20WebKit
and noticing the other editors using WebKit I got to thinking that
this would be a nice feature to add to MacVim. Initially it could be
as simple as an call to the 'open' command which would make it open or
refresh in your default browser (possibly could be set up now!?) but
could also open an associated/attached window which could live refresh
as you type !

CHEERS
Poorly

Nico Weber

unread,
Nov 14, 2007, 1:58:30 AM11/14/07
to vim...@googlegroups.com
Hi,

You're talking about editing html files, right?

You can put

map zp :w\|!open %<cr>

in your _vimrc; afterwards you can open the currently open file in
Safari by pressing zp (you can map this to something else if you
prefer of course). Having a live refresh would be quite sluggish (and
you probably don't have valid html while you are typing), so this
might not be a great idea (but could be done with the cursormoved
autocommand I guess -- let me know if you need help setting this up).

HTH,
Nico

Niklas Lindström

unread,
Nov 14, 2007, 10:58:32 AM11/14/07
to vim...@googlegroups.com
Hi!

Another option for the experimentally inclined would be to use a
MacVim compiled with e.g. python or ruby, and try out what can be done
with their respective Scripting Bridges, PyObjC (2) and RubyCocoa,
both of which are included out-of-the-box in Leopard (which is
great!). See e.g.:

:help :python
:help :ruby

and google for stuff like blogposts about the brigdes (like
<http://griddlenoise.blogspot.com/2007/11/applescripting-across-universe.html>).

Of course, "!open" and similar is often good enough for these things;
but still.. :)

Best regards,
Niklas

Reply all
Reply to author
Forward
0 new messages