edenzik / macvim

Automatically exported from code.google.com/p/macvim
0 stars 0 forks source link

RFE: Quck View #171

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Gee wouldn't it be nice if all types that I associate to open with MacVim
could be viewed with quickview or quicklook or whatever it's called, the
way normal .txt files are? Even if it meant just passing along whatever
magic word that says to use the internal txt renderer.

Original issue reported on code.google.com by fug...@gmail.com on 22 Apr 2009 at 3:33

GoogleCodeExporter commented 9 years ago
Do you mean only normal text preview? This should work for most filetypes 
already. Which are missing?

Due to technical reasons, it is not possible to let MacVim render 
syntax-highlighted previews, though.

Original comment by nicotha...@gmail.com on 22 Apr 2009 at 4:04

GoogleCodeExporter commented 9 years ago
I'd be happy with a plain-text preview. 

An example would be that I added a new filetype to vim for markdown (extension 
mkd)
and assigned macvim to open files of that type with the finder. The finder of 
course
knows nothing about mkd and so just displays a blank page. I don't know if it 
would
be possible, but ideally the associated application (MacVim in this case) would 
help
finder figure out how to preview it (and any other file associated with macvim, 
that
doesn't have a better preview already).

Original comment by fug...@gmail.com on 22 Apr 2009 at 4:27

GoogleCodeExporter commented 9 years ago
I looked into this and it seems that you can support Quick Look by adding some 
entries to the Info.plist (Nico 
already did this for .vim files if I remember correctly).  What I can do is to 
add all the currently known file 
extensions and add more later if necessary.

Original comment by bjorn.winckler@gmail.com on 25 Apr 2009 at 2:29

GoogleCodeExporter commented 9 years ago
This was fixed in snapshot 46.

Original comment by bjorn.winckler@gmail.com on 13 Jul 2009 at 10:51

GoogleCodeExporter commented 9 years ago
I love MacVim. Could you add suppert for Quick View or Quick Look for xml 
files? Or how could i do this myself 
for a quick look as plain text? 

Tanks

Original comment by sacalmoi...@gmail.com on 3 Sep 2009 at 8:40

GoogleCodeExporter commented 9 years ago
I tried adding Quick Look support for xml files (preview as plain text) but for 
some reason Mac OS X refuses to 
show xml files as plain text.  Please look into it and see if you can figure 
out how to get it to work (if you are 
able) and let me know how it goes.

Original comment by bjorn.winckler@gmail.com on 3 Sep 2009 at 9:02

GoogleCodeExporter commented 9 years ago
So, I've come up with a hacky solution for this that almost works.

QuickLook is built to display HTML, so the QuickLook bundle I was working on 
would basically run `vim -En -c TOhtml -c "w! <tmp outfile>" -c 'qa!' -- 
<infile>`, read in the HTML file, delete the file, and pass the contents to the 
QuickLook renderer.

The problem with this is that vim wants a terminal environment to run, which it 
didn't have for this. The mvim command (well, script) passes this duty off to 
MacVim and therefore can be run from a non-tty environment. I modified the 
plugin to run with `mvim -nf -c TOhtml -c 'w! <tmp outfile>' -c 'qa!' -- 
'<infile>'` instead, and it almost works.

The current problem is that when it gets called, MacVim briefly creates a 
window and is foregrounded, and that cancels the QuickLook preview. I believe 
that if another flag was added to mvim to allow this to be done without 
foregrounding the application, that this process would actually work.

Now, it would still require that MacVim be running, and it's still a major 
hack. The other option is trying to use something like vimcat and converting 
that, but I'd prefer to use as much built-in vim/MacVim functionality as 
possible.

Would you be willing to add a flag like this to make my hack work? I'd be more 
than happy to share it, once I get it working and clean up the tmp file path 
creation and add more error handling.

Original comment by petez...@gmail.com on 14 Mar 2013 at 10:21

GoogleCodeExporter commented 9 years ago
So… I was able to get this to work by using the `script` executable to fake a 
TTY environment for regular `vim`. I'm still working out the thumbnail and 
mini-preview stuff, but the full preview (spacebar) seems to be working. I'll 
clean up the code and post it somewhere, if people are interested.

Original comment by petez...@gmail.com on 25 Mar 2013 at 7:35

GoogleCodeExporter commented 9 years ago
petez - that sounds great, did you end up sharing that code somewhere?

Original comment by konradla...@gmail.com on 10 Jun 2013 at 12:24