photo of Yunt

云一样的梦…

只是当时已惘然

Vim中使用Stardict

今天看到有人用emacs配合sdcv(stardict CLI版)写了个在其中查词的功能,
效果不错,因为不用emacs,所以就写了个在vim中使用的!
gvim下的挺完美的,因为vim里没有calltip的功能所以只能分割窗口了……
具体如下:

在~/.gvimrc中加入这些:
function Mybln()
    let expl=system('sdcv -n ' .
          \ v:beval_text .
          \ '|fmt -cstw 40')
    return expl
  endfunction

  set bexpr=Mybln()
  set beval

效果如下,鼠标放在单词上显示!

在~/.vimrc中加入这些:
function! Mydict()
  let expl=system('sdcv -n ' .
        \  expand("<cword>"))
  windo if
        \ expand("%")=="diCt-tmp" |
        \ q!|endif
  25vsp diCt-tmp
  setlocal buftype=nofile bufhidden=hide noswapfile
  1s/^/\=expl/
  1
endfunction
nmap F :call Mydict()<CR>

在单词上使用Shift+f ,效果:

计算圆周率(π)心情不好时做这25件事

Comments

Anonymous Wednesday, June 21, 2006 6:51:00 AM

Anonymous writes: 是你自已写的?

Yuntyunt Wednesday, June 21, 2006 8:02:36 AM

哦,不,我是在hq00e那里得到的帮助!!

Anonymous Tuesday, November 21, 2006 3:44:36 PM

Anonymous writes: 哈,效果很不错啊,这个应该是Linux下实现的吧,Windows下可以吗? PS:非常郁闷,宿舍的朋友都习惯了吃饭时用PPLive看新闻,所以不能安装Linux,不知道Linux下有没有PPLive这样的软件?

Yuntyunt Thursday, November 30, 2006 3:39:38 AM

Anonymous Sunday, December 3, 2006 4:27:42 AM

lerosua writes: 博主你好/ 你这个技巧很好/ 之前我也调用过sdcv, 不过不会打开新窗口。 这功能值得推广。所以我想在我博客上引用你这篇文章。特此通知。谢谢! 我的博客地址 http://my.donews.com/lerosua

InterMainterma Tuesday, January 23, 2007 3:43:58 PM

奥,真不错~

Anonymous Wednesday, November 24, 2010 11:15:11 PM

wenjiale@gmail.com writes: 无知的一群人

Anonymous Sunday, July 31, 2011 6:13:32 AM

Анонімний writes: I received my first credit loans when I was 32 and this supported me a lot. Nevertheless, I require the consolidation loans also.

Anonymous Sunday, July 31, 2011 6:15:45 AM

Анонімний writes: I received my first business loans when I was 32 and it helped my relatives a lot. But, I require the credit loan over again.

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies