thinca / vim-ref

Integrated reference viewer.
204 stars 39 forks source link

webdict ソースに start_linenumber オプションを追加してみました。 #15

Closed atton closed 12 years ago

atton commented 12 years ago

rfc ソースからの流用で、webdict ソースに start_linenumber オプションを追加してみました。

g:ref_source_webdict_start_linenumber が設定されていると、その行から結果を表示します。 デフォルトの値は0です。

(将来の拡張を考えるとwebdictのsitesごとに設定できた方が良いかもしれない感もありますが)

thinca commented 12 years ago

開始行はサイトごとに違う設定にしたいと思うので、微妙な感がありますね…。 ちなみにWebサイトの定義時に filter を設定することで不要な部分は削ることができるのですが、それでは不十分でしょうか?

例: 先頭18行を消す

let g:ref_source_webdict_sites = {
\   'wikipedia': {'url': 'http://ja.wikipedia.org/wiki/%s'},
\ }

function! g:ref_source_webdict_sites.wikipedia.filter(output)
  return join(split(a:output, "\n")[18 :], "\n")
endfunction

入れるとしてもサイト定義の方に入れたほうが良さそうです。

atton commented 12 years ago

えーっと、filterでは不十分な点はは特に無いです。 単に好みというか、消した部分に必要なものがあるかもしれないので、消すよりは残っていた方が良いのかな、程度の考えだったので…… siteの方での定義は私にはできなさそうなので、filterを設定してみることにします。 ありがとうございました。

thinca commented 12 years ago

site 定義に "line" オプションを追加してみました。

6953de5c28c92a67b5e60bd7b3b555e9f7a0cff7

atton commented 12 years ago

確認しました。ありがとうございます!