Thursday, March 3, 2011

Re: Any dict plugin to translate English to Japanese?

Another simple function to dump the result to yahoo dic to quickfix window.

function Dict(cmd)
let tmpfile = tempname()
let l:list=system("w3m -dump http://dic.yahoo.co.jp/search?p=" . a:cmd)
exe "redir! > " . tmpfile
silent echon l:list
redir END
if exists(":cgetfile")
execute "silent! cgetfile " . tmpfile
else
execute "silent! cfile " . tmpfile
endif
" Open the quickfix window below the current window
botright copen
execute "/全.*件"
call delete(tmpfile)
endfunction

com -nargs=* Dict call Dict(<f-args>)
vmap <C-\>q y:Dict <C-R>0<CR>
nmap <C-\>q :Dict <C-R>=expand("<cword>")<CR><CR>


Regards,
robert

On 2/25/11, robert song <robertsong.japan@gmail.com> wrote:
> A very simple function to dump the selected word from dic yahoo and show
> the
> result.
>
>
> Add the following part to .vimrc file.
>
> function Dict(cmd)
> execute "new"
> execute "r!w3m -dump http://dic.yahoo.co.jp/search?p=". a:cmd
> normal gg
> endfunction
> com -nargs=* Dict call Dict(<f-args>)
> vmap <C-\>q y:Dict <C-R>0<CR>
> nmap <C-\>q :Dict <C-R>=expand("<cword>")<CR><CR>
>

--
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

No comments:

Post a Comment