Hi guys/experts:
sorry for wide-expend, but I can't figure out a solution for this...
below is the response to my original issue I got from author of Utl plugin:
http://www.vim.org/scripts/script.php?script_id=293
to summarize:
==issue==
use Utl, linking to an external file, when external file is text it
works perfect.
regardless of Utl, with autocmd I can open MS-word files from inside vim
perfectly.
problem is , with Utl linking to external MS-word file, it doesn't work,
instead it give me an empty buffer instead of buffer of the rendered
external file in the text format (this is my target).
==my Utl related config==
let g:utl_cfg_hdl_mt_application_msword="VIM"
==my autocmd==
see below
b.t.w I feel this is a good feature brought by Utl plugin -- it turns
text file into a hyper-linked page, analogous to the vim help file
feature but still be independent of the FT -- just ideally if this
"linking to autocmd rendered external file" feature can work...
regards
ping
-------- Original Message --------
Subject: Re: vim Utl plugin: how to render a linked doc file
Date: Wed, 27 Jun 2012 09:21:30 +0200
From: stefan.bittner@bf-consulting.de
To: songpingemail@gmail.com
Hi,
sorry for the late answer.
If I test with a MS Word document, having in my .vimrc file:
let g:utl_cfg_hdl_mt_application_msword="VIM"
but without these autocmd commands, then I get the Word file displayed
inside Vim when I open it with :Utl . It is of course displayed as
binary data since the .doc is binary data.
Now, when I use these autocmd command, but replacing antiword with
notepad since I have no antiword installed:
autocmd BufReadPre *.doc set ro
autocmd FileReadPre *.doc set ro
autocmd BufReadPre *.doc set hlsearch!
autocmd BufReadPost *.doc %!notepad "%"
autocmd FileReadPost *.doc %!notepad "%"
I get a .doc file displayed in Notepad, ending up inside Vim with an
empty buffer as you described.
So I guess you should modify your autocmd in order not to open the
file externally (in antiword/notepad) but rather filter it and feed it
back into Vim.
I think Utl is not part of your problem.
Regards,
Stefan
> -------- Original-Nachricht --------
> Betreff: Re: vim Utl plugin: how to render a linked doc file
> Datum: Thu, 14 Jun 2012 15:59:43 -0400
> Von: ping <songpingemail@gmail.com>
> An: Stefan Bittner <stefan.bittner@bf-consulting.de>, vim-use
> Mailingliste <vim_use@googlegroups.com>
>
>
>
> hi Stefan:
> sorry I don't know why but somehow email from you were put into SPAM here...
> please see my comments in lines to better answer you.
> please let me know if you have any advice.
>
> On 06/04/2012 12:12 PM, Stefan Bittner wrote:
>> Hi,
>>
>> as I understand your usage, files with an extension ".doc" are not
>> Microsoft-Word documents, but rather text files like a .txt
>> extension.
> *no that is not the case. ".doc" IS MS docs, I use following autocmd to
> open MS-word docs in vim and it works just fine:
>
> "doc to text
> autocmd BufReadPre *.doc set ro
> autocmd FileReadPre *.doc set ro
> autocmd BufReadPre *.doc set hlsearch!
> autocmd BufReadPost *.doc %!antiword "%"
> autocmd FileReadPost *.doc %!antiword "%"
>
> so my goal here is , instead of launch an external handler APP(MS
> office or OOO suite), I want Utl to try open the
> MS word doc ,via using these autocmd to render it, all from inside vim
> -- either in a new buffer in same window or a new tab.*
>
>>
>> What happens is that some extensions (as ".doc" is) are hard coded
>> into Vim which means, that utl.vim is looking for a handler that
>> deals with the document. In your case no one is defined.
>>
>> In order to display files, for which a handler is involved, in Vim,
>> you can provide a handler variable with the special value "VIM".
>> In your case you should put the following line into you .vimrc file:
>>
>> let g:utl_cfg_hdl_mt_application_msword="VIM"*
>> *
> *I put this in .vimrc and restart it, still not working.
> it seems open a new empty buffer.*
>
>>
>> Hope that helps,
>> Regards,
>>
>> Stefan
>>
>> Am 31.05.2012 20:31, schrieb ping:
>>> stefen:
>>> I'm using vim Utl plugin and enjoy it.
>>> http://www.vim.org/scripts/script.php?script_id=293
>>> but today I run into an issue here.
>>> so if I use this in my text:
>>>
>>> 7 habit <url:books/7\ habits\ of\ highly\ effective\
>>> people.txt>
>>>
>>> it works. it will jump into the folder books and open linked file
>>> in current window for me.
>>>
>>> while if I use this:
>>>
>>> 7 habit <url:books/7\ habits\ of\ highly\ effective\
>>> people.doc>
>>>
>>> it report:
>>> No handler for media type application/msword defined yet. Entering
>>> Setup now. <RETURN>
>>>
>>> and i f I return it goes to the Utl help.
>>>
>>> I already have these setup in my vimrc file:
>>>
>>> "doc to text
>>> autocmd BufReadPre *.doc set ro
>>> autocmd FileReadPre *.doc set ro
>>> autocmd BufReadPre *.doc set hlsearch!
>>> autocmd BufReadPost *.doc %!antiword "%"
>>> autocmd FileReadPost *.doc %!antiword "%"
>>>
>>> so if I :open/:read a doc file it will be automatically rendered into vim.
>>>
>>> is there anything missed here?
>>>
>>> copy to the vim google group if anyone else knows how-to.
>>>
>>> thanks!
>>>
>>
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Saturday, June 30, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment