ianva / vim-youdao-translater

vim的有道取词翻译插件
ianva.github.com
Other
132 stars 32 forks source link

vim 7.x 兼容 #28

Closed ZSaberLv0 closed 5 years ago

ZSaberLv0 commented 6 years ago

能否保持对 vim 7.x 的兼容? 有些旧环境升 vim 8 还是比较麻烦的

目前的问题:

Error detected while processing /root/.vim/bundle/vim-youdao-translater/plugin/ydt.vim:
line    2:
E121: Undefined variable: v:true
E15: Invalid expression: {'stdout_buffered': v:true, 'stderr_buffered': v:true}
line    4:
E121: Undefined variable: s:translator
line    5:
E121: Undefined variable: a:data
E116: Invalid arguments for function empty(a:data) | echo join(a:data) | endif
E15: Invalid expression: !empty(a:data) | echo join(a:data) | endif
line    6:
E193: :endfunction not inside a function
line    7:
E121: Undefined variable: s:translator
E116: Invalid arguments for function function(s:translator.on_stdout)
E15: Invalid expression: function(s:translator.on_stdout)
line    9:
E121: Undefined variable: s:translator
line   13:
E133: :return not inside a function
line   16:
E121: Undefined variable: a:lines
E116: Invalid arguments for function printf("%s %s %s", python_cmd, s:translator_file, a:lines)
E15: Invalid expression: printf("%s %s %s", python_cmd, s:translator_file, a:lines)
line   18:
E133: :return not inside a function
line   20:
E133: :return not inside a function
line   24:
E193: :endfunction not inside a function
ianva commented 6 years ago

暂时切换到 2.5.1 版

ZSaberLv0 commented 6 years ago

@ianva 新版本是否有计划继续保持 vim 7.x 的兼容? 如果没有, 建议保留旧版本的分支 (而不是只在 release 里面有), 否则插件管理不太方便, 谢谢

ianva commented 6 years ago

我自己是 vim 7.x 的版本,并未遇到问题,请确切的说下安装方式,和使用环境

ZSaberLv0 commented 6 years ago

@ianva 用 vim-plug 安装, 除按键映射外没有其他配置

Python 2.6.6

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 21 2016 17:10:41)
Included patches: 1-207, 209-629
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
pinggit commented 6 years ago

我也是用vim-plug的安装方式。vim8。每次必现。。。

pinggit commented 6 years ago

root@server1:~# vim Error detected while processing /root/.vim/bundle/vim-youdao-translater/plugin/ydt.vim: line 2: E121: Undefined variable: v:true E15: Invalid expression: {'stdout_buffered': v:true, 'stderr_buffered': v:true} line 4: E121: Undefined variable: s:translator line 5: E121: Undefined variable: a:data E116: Invalid arguments for function empty(a:data) | echo join(a:data) | endif E15: Invalid expression: !empty(a:data) | echo join(a:data) | endif line 6: E193: :endfunction not inside a function line 7: E121: Undefined variable: s:translator E116: Invalid arguments for function function(s:translator.on_stdout) E15: Invalid expression: function(s:translator.on_stdout) line 9: E121: Undefined variable: s:translator line 13: E133: :return not inside a function line 16: E121: Undefined variable: a:lines E116: Invalid arguments for function printf("%s %s %s", python_cmd, s:translator_file, a:lines) E15: Invalid expression: printf("%s %s %s", python_cmd, s:translator_file, a:lines) line 18: E133: :return not inside a function line 20: E133: :return not inside a function line 24: E193: :endfunction not inside a function line 2: E121: Undefined variable: v:true E15: Invalid expression: {'stdout_buffered': v:true, 'stderr_buffered': v:true} line 4: E121: Undefined variable: s:translator line 5: E121: Undefined variable: a:data E116: Invalid arguments for function empty(a:data) | echo join(a:data) | endif E15: Invalid expression: !empty(a:data) | echo join(a:data) | endif line 6: E193: :endfunction not inside a function line 7: E121: Undefined variable: s:translator E116: Invalid arguments for function function(s:translator.on_stdout) E15: Invalid expression: function(s:translator.on_stdout) line 9: E121: Undefined variable: s:translator line 13: E133: :return not inside a function line 16: E121: Undefined variable: a:lines E116: Invalid arguments for function printf("%s %s %s", python_cmd, s:translator_file, a:lines) E15: Invalid expression: printf("%s %s %s", python_cmd, s:translator_file, a:lines) line 18: E133: :return not inside a function line 20: E133: :return not inside a function line 24: E193: :endfunction not inside a function Press ENTER or type command to continue ···

voldikss commented 6 years ago

@pinggit 真的是 Vim8 吗?这个 v:true 变量是 patch 7.4.1154 里面加上的,Vim8 应该不会出现这个问题。你可能用的是 7 版本,如果是这样那可以升级一下。 另外,其实 Neovim 很好用的。

pinggit commented 6 years ago

你说的没错。抱歉我看错了。版本是: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32)

请问这个有什么办法解决吗? 我有很多vim7.4的系统安装这个插件报错。 谢谢!

On Tue, Oct 2, 2018 at 10:49 AM VoldikSS notifications@github.com wrote:

@pinggit https://github.com/pinggit 真的是 Vim8 吗?这个 v:true 变量是 patch 7.4.1154 https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a 里面加上的,Vim8 应该不会出现这个问题。 另外,其实 Neovim 很好用的。

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ianva/vim-youdao-translater/issues/28#issuecomment-426302940, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8ZHEqrxCcMyyI1YxBJzPqh4Bg3ijTYks5ug30MgaJpZM4UCUy8 .

voldikss commented 6 years ago

建议升级,Vim74 太老了,现在好多插件都需要 Vim8 的异步特性,要么升 Vim8,要么试试 Neovim

pinggit notifications@github.com 于 2018年10月6日周六 下午12:06写道:

你说的没错。抱歉我看错了。版本是: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32)

请问这个有什么办法解决吗? 我有很多vim7.4的系统安装这个插件报错。 谢谢!

On Tue, Oct 2, 2018 at 10:49 AM VoldikSS notifications@github.com wrote:

@pinggit https://github.com/pinggit 真的是 Vim8 吗?这个 v:true 变量是 patch 7.4.1154 < https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a>

里面加上的,Vim8 应该不会出现这个问题。 另外,其实 Neovim 很好用的。

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/ianva/vim-youdao-translater/issues/28#issuecomment-426302940>,

or mute the thread < https://github.com/notifications/unsubscribe-auth/AB8ZHEqrxCcMyyI1YxBJzPqh4Bg3ijTYks5ug30MgaJpZM4UCUy8>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ianva/vim-youdao-translater/issues/28#issuecomment-427544061, or mute the thread https://github.com/notifications/unsubscribe-auth/ATV9q87EmJm5S3DHzQ5nY6o6FW7eSswlks5uiCxUgaJpZM4UCUy8 .

ZSaberLv0 commented 6 years ago

可以的话建议还是保持兼容吧, 毕竟 vim 的优势是各种奇葩环境都能用, 比如 ssh 到服务器, 很少人会愿意特意去升级服务器的 vim 版本的 如果确实难以兼容, 是否考虑下 README 里添加旧版本兼容说明?

个人认为, 翻译这种需求, 没有异步卡个一两秒并不是太大的问题, 但因为 vim 版本不够而基本功能都不能用反而是比较烦的问题