shougo / vimproc.vim Goto Github PK
View Code? Open in Web Editor NEWInteractive command execution in Vim.
Interactive command execution in Vim.
実行に失敗する .jsx ファイルを vimproc#system で実行を行うと値が返ってきません。
[main.jsx]
class _Main{
static function main(args : string[]) : void {
log "hello, world" // ; 抜け
}
}
[コマンド]
echo vimproc#system("jsx --run main.jsx")
上記のコマンドを実行しても何も出力がされません。
上記と同じコードで system を使用した場合では下記のような値が返ってきます。
[main.jsx:4] expected keyword: ;
}
^
また、実行に成功するコードでは正しい値(上記の場合では "hello, world")が返ってきます。
[Vim]
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 21 2012 09:09:24)
MS-Windows 32 ビット GUI 版
適用済パッチ: 1-502
Modified by [email protected]
Compiled by [email protected]
Big 版 with GUI. 機能の一覧 有効(+)/無効(-)
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver
+clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope
+cursorbind +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer
+gettext/dyn +guess_encode -hangul_input +iconv/dyn +insert_expand +jumplist +keymap
+kaoriya +langmap +libcall +linebreak +lispindent +listcmds +localmap +lua/dyn +menu
+migemo/dyn +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang
-mzscheme +netbeans_intg -ole +path_extra +perl/dyn +persistent_undo -postscript +printer
-profile +python/dyn +python3/dyn +quickfix +reltime +rightleft +ruby/dyn +scrollbind
+signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl -tgetent -termresponse +textobjects +title +toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore
+wildmenu +windows +writebackup -xfontset -xim -xterm_save -xpm_w32
システム vimrc: "$VIM\vimrc"
ユーザ vimrc: "$HOME\_vimrc"
第2ユーザ vimrc: "$VIM\_vimrc"
ユーザ exrc: "$HOME\_exrc"
第2ユーザ exrc: "$VIM\_exrc"
システム gvimrc: "$VIM\gvimrc"
ユーザ gvimrc: "$HOME\_gvimrc"
第2ユーザ gvimrc: "$VIM\_gvimrc"
システムメニュー: "$VIMRUNTIME\menu.vim"
コンパイル: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG /DMODIFIED_BY=\"[email protected]\" /DDYNAMIC_MSVCRT_DLL=\"msvcr100.dll\" /DGETTEXT_DLL=\"intl.dll\" /D_BIND_TO_CURRENT_VCLIBS_VERSION=1 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 /Fo.\Obj\GULYHR-x86/ /Ox /GL -DNDEBUG /MD -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DDYNAMIC_MIGEMO -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua5.1.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python32.dll\" -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl514.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=192 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby191.dll\" -DFEAT_BIG /Fd.\Obj\GULYHR-x86/ /Zi
リンク: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:i386 /nodefaultlib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib msvcrt.lib user32.lib /nodefaultlib:lua5.1.lib /nodefaultlib:python27.lib /nodefaultlib:python32.lib WSock32.lib /PDB:gvim.pdb -debug
It seems that makefile change in revision 5d79315 makes compiled vimproc.so incompatible with Macvim. According to mvim --version MacVim is compiled with 32-bit (-arch i386).
I tested with MacVim snapshot 64 and the Apple-built stock vim on Mac OS X 10.7.3.
I tested reverting the change and rebuilding, and the resulting library seems to work ok in both versions.
現在の vimproc の仕様で気になっている点のうち、私のほうで修正・変更可能なものを挙げます。
Redirection
現在、以下の形式のリダイレクションができません。
2>&1
: stderr が vim と同じ端末に出力される (stdout の出力先と違う)1>&2
: 効果なし (リダイレクトとして扱われない)<&-
, [12]>&-
(ストリームを閉じる) : 効果なし2>&1 >file
: コマンドが実行されない (or すぐ終了する) ?3>&1 1>&2 2>&3
(stdout と stderr を交換) : 効果なしまた、/dev/null
が pseudo_device 扱いで、リダイレクト時のIO処理を呼び出し側で行うようになっていますが、これはなぜでしょうか?
(Windows 環境の問題?)
Pipeline
POSIX仕様ではパイプライン A | B | C
の各プロセスA, B, Cは同じプロセスグループに属しますが、現在の vimproc では各々が異なるプロセスグループになります。
これはこのままでよいでしょうか?
Pty
is_pty==1
の場合には forkpty()
で新規セッションと制御端末を与えていますが、
セッションは作らず openpty()
で新規端末を割り当てるだけでよいのでは?
(openpty()
して fork()
、制御端末は vim と同じ)
また、npipe==3
のときに stderr に openpty()
で端末を割り当てていますが、
大抵の場合はパイプでも十分なように思います。
(1>&2
した場合に stdout を buffering されたくないならば、端末が必要ですが...)
現象
Windows7 64bit で、「set encoding=sjis」とすると、 g:vimproc_dll_path のセパレータが '?' になり、
VimShell などの実行に失敗します。
パスを sjis 変換してバックスラッシュが '?' になっている感じでしょうか?
以下、 echo g:vimproc_dll_path の実行結果
C:?Users?mikoto?.vim?bundle?vimproc?autoload/vimproc_win64.dll
確認環境
Windows7 64bit, vim, gvim で確認。
2012/08/29 1:40 に 「Unite neobundle/update」 実行。
make -f make_unix.mak
make[1]: Entering directory/home/dm/.vim/bundle/vimproc' gcc -W -O2 -Wall -Wno-unused -std=gnu99 -pedantic -shared -fPIC -o autoload/vimproc_unix.so autoload/proc.c -lutil autoload/proc.c: In function 'vp_dlversion': autoload/proc.c:162:20: warning: unused parameter 'args' [-Wunused-parameter] vp_dlversion(char *args) ^ make[1]: Leaving directory
/home/dm/.vim/bundle/vimproc'
gcc version is 4.8.1
I use a 64-bit vim on win64. The mingw makefile does not procedure a usable binary file. I got Library call failed for "vp_pipe_open()" runtime error when I try to do manual complete in neocomplcache. The provided precompiled file work smoothly.
vimfilerで使用しているのですが、vp_readdir()に"/"を入力するとパスの先頭が"//"となるリストになります。
ローカルではパッチで、dp取得後にdirnameの末尾に"/"が付いていたら'\0'詰めするようにしています。
お時間ありましたら、設計に合わせた修正をお願い出来ますでしょうか?
/home/user/a は /home/user/test へのシンボリックリンクだとします。
/home
/user
/test
1.txt
2.txt
/a => /home/user/test
bash では ls /home/user/a/*
を実行すると
1.txt 2.txt
と表示されますが、vimshell の場合はエラーとなってしまいます。
bash と同様に、ワイルドカード展開時にもシンボリックリンクを解決してほしいです。
よろしくお願いします。
あー、5/17の版から vimproc#system() でパイプが使えなくなってるんだな~。元々ドキュメントにも使えるとも使えないとも書いてないから、Issue登録しづらい。
— sgurさん (@sgur) 2013年5月21日
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
@sgur それはないはずです。私の環境では動作しています。テストスクリプト、環境、詳しい状況を整理してIssues登録してもらえますか。
— Shougo(暗黒美夢王)さん (@ShougoMatsu) 2013年5月22日
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
の件です。
a9543d7 以降で発生しています。
kaoriya 版 7.3.969 (x64)
独自ビルド(MSVC2012) hg trunk (x64)
echo vimproc#system('ls | grep a')
※ Win 上の msys の ls と grep を使っています。
function vimproc#system..<SNR>95_system..<SNR>95_read_pgroup..<SNR>95_vp_waitpid..<SNR>95_close_all..<SNR>95_close..<SNR>95_vp_pipes_close..<SNR>95_close..<SNR>95_vp_pipe_close..<SNR>95_libcall, 行 16
Line https://github.com/Shougo/vimproc.vim/blame/master/README.mkd#L46
cd ~/.vim/bundle/vimproc.vim
gives an error cd: ~/.vim/bundle/vimproc.vim: No such file or directory
I think something should be added to previous git command.
function neocomplete#handler#_do_auto_complete..neocomplete#complete#_set_results_pos..neocomplete#helper#call_hook..211..217_check_source..217_make_cache_current_bl
ock..217_make_cache_current_buffer..217_make_cache..neocomplete#cache#async_load_from_file..239_async_load..vimproc#system_bg..vimproc#pgroup_open..223_pgr
oup_open, line 2
Vim(let):E121: Undefined variable: statement
https://github.com/Shougo/vimproc.vim/blob/master/autoload/vimproc.vim#L809
この行の置換により,例えば
/home/yuuki/tmp/t/test.pl
のようなパスが
/home/yuuki/tmp/test.pl
に変換されてしまいます.
問題が起こるのはディレクトリ名が1文字のものがパスに含まれている場合です.
この行の処理の意図が理解できておらず,どのように直せばよいかわからなかったので,とりあえず報告だけしておきます.
よろしくお願い致します.
I can't compile with VC 2005:
-Fdautoload\ -Foautoload\ autoload\proc_w32.c
'-Fdautoload' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: '-Fdautoload' : return code '0x1'
Stop.
But I can compile in Cygwin.
Thanks
I have no idea.
I Use Vim 7.3 for Windows (official distribution) on Windows XP SP3.
vimproc_win32.dll is built by mingw32-make 3.82.90.
>mingw32-make --version
GNU Make 3.82.90
Built for i686-pc-mingw32
Copyright (C) 1988-2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
>mingw32-make -f make_mingw32.mak
I tested vimproc using minimum rc file ( https://gist.github.com/AmaiSaeta/5229154 ).
> vim -u ~/test.vimrc
vesting log is...
Sources: vesting:.:test-functions (3/3), vesting:.:test-lexer (9/9), vesting:.:test-parser (10/10), vesting:.:test-popen (2/2), vesting:.:test-socket (6/6), vesting:.:test-fopen (7/7), vesting:.:test-system (2/2)
[vesting] ./vest/test-functions.vim: OK = 2, Fail = 0, Error = 0
[vesting] ./vest/test-lexer.vim: OK = 8, Fail = 0, Error = 0
[vesting] ./vest/test-parser.vim: OK = 8, Fail = 0, Error = 1
[vesting] ./vest/test-popen.vim: OK = 0, Fail = 0, Error = 1
[vesting] ./vest/test-socket.vim: OK = 2, Fail = 3, Error = 0
[vesting] ./vest/test-fopen.vim: OK = 6, Fail = 0, Error = 0
[vesting] ./vest/test-system.vim: OK = 0, Fail = 0, Error = 1
>
- vesting [Vest] ./vest/test-functions.vim
- vesting [OK] .
- vesting [OK] .
- vesting [Vest] ./vest/test-lexer.vim
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [Vest] ./vest/test-parser.vim
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting + [Error] C:\Documents and Settings\AmaiSaeta\vimbundles\vimproc\ves~
- vesting | t\test-parser.vim:0: function vimproc#parser#split_args..<SNR>5~
- vesting | 1_parse_double_quote..<SNR>51_parse_back_quote..vimproc#system.~
- vesting | .<SNR>46_system..vimproc#pgroup_open..<SNR>46_pgroup_open..vimp~
- vesting | roc#plineopen3..<SNR>46_plineopen..<SNR>46_convert_args..vimpro~
- vesting [Vest] ./vest/test-popen.vim
- vesting + [Error] C:\Documents and Settings\AmaiSaeta\vimbundles\vimproc\ves~
- vesting | t\test-popen.vim:0: function vimproc#popen2..<SNR>46_plineopen.~
- vesting | .<SNR>46_convert_args..vimproc#get_command_name, 行 15 : vimpro~
- vesting | c#get_command_name: File "ls" is not found.
- vesting [Vest] ./vest/test-socket.vim
- vesting + [Fail] C:\Documents and Settings\AmaiSaeta\vimbundles\vimproc\ves~
- vesting | t\test-socket.vim:0: It checks host exists : vimproc#host_exist~
- vesting | s('www.yahoo.com') == 1
- vesting + [Fail] C:\Documents and Settings\AmaiSaeta\vimbundles\vimproc\ves~
- vesting | t\test-socket.vim:0: It checks host exists : vimproc#host_exist~
- vesting | s('https://www.yahoo.com') == 1
- vesting + [Fail] C:\Documents and Settings\AmaiSaeta\vimbundles\vimproc\ves~
- vesting | t\test-socket.vim:0: It checks host exists : vimproc#host_exist~
- vesting | s('https://www.yahoo.com/hoge/piyo') == 1
- vesting [OK] .
- vesting [OK] .
- vesting [Vest] ./vest/test-fopen.vim
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [OK] .
- vesting [Vest] ./vest/test-system.vim
- vesting + [Error] C:\Documents and Settings\AmaiSaeta\vimbundles\vimproc\ves~
- vesting | t\test-system.vim:0: function vimproc#system..<SNR>46_system..v~
- vesting | improc#pgroup_open..<SNR>46_pgroup_open..vimproc#plineopen3..<S~
- vesting | NR>46_plineopen..<SNR>46_convert_args..vimproc#get_command_name~
- vesting | , 行 15 : vimproc#get_command_name: File "ls" is not found.
( It seems that the display of a row number has gone wrong. )
When I run either of the MinGW makefiles, I get this output:
C:\Users\Noah.vim\bundle\vimproc>make -f make_mingw32.mak
gcc -O2 -Wall -shared -m32 -o autoload/vimproc_win32.dll autoload/proc_w32.c -lw
sock32
process_begin: CreateProcess((null), gcc -O2 -Wall -shared -m32 -o autoload/vimp
roc_win32.dll autoload/proc_w32.c -lwsock32, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [autoload/vimproc_win32.dll] Error 2
I've never compiled anything before, so I don't know if I've done something wrong. Have I? What's my next step?
If I set encoding to utf-8 on Windows, vimproc starts complaining about termencoding. I do not think you need to look at termencoding on Windows at all (at least not in GUI version definitely).
Hello, Shougo, first, I want to thank you for these awesome plugins you made!
Recently I found my neocomplete always hangs when doing include caching.
When I remove vimproc(only have neocomplete turned on, others are all off), the problem disappeared, I firstly thought it's neocomplete's issue until I found this report Shougo/neobundle.vim#131
I've installed both vimproc and neocomplete properly, the code compiled successfully.
So I guess that vimproc hangs for some reason, but I checked the the process cpu usage, vim was always taking 100% cpu when hanging. So I guess there's something wrong in the vimscript code.
The problem has never happened before until I recently updated all my plugins(including vimproc).
Here's some info:
vim version:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 17 2013 23:09:56)
MacOS X (unix) version
Included patches: 1-52
Compiled by ofan@self
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 +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
system vimrc file: "/opt/local/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/opt/local/share/vim"
Compilation: ccache /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp -pipe -Os -arch x86_64 -I/opt/local/include -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1
Linking: ccache /usr/bin/clang -L. -L/opt/local/lib -Wl,-headerpad_max_install_names -L/usr/local/lib -L/opt/local/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -L/usr/local/lib -o vim -lncurses -liconv -lintl -framework Cocoa -L/opt/local/lib -llua -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector -L/opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -framework CoreFoundation -lpython2.7 -L/opt/local/lib -ltcl8.6 -lz -framework CoreFoundation -lruby.1.9.1 -lobjc -L/opt/local/lib
こんにちはyuratomoです。
次のようにw3m -halfdump を実行するとエラーがでてしまいます。
:call vimproc#system('w3m -halfdump http://www.yahoo.co.jp/')
ちなみに、http://www.google.co.jp は大丈夫でした。
対応可能でしょうか?
[環境]
os: Windows XP Home
vimproc: Last Modified: 07 Mar 2012.
w3m: mingw版
[エラー内容]
function vimproc#system..63_system..63_read_pgroup..63_read_pipes..63_read..63_hd2str..63_libcall の処理中にエラーが検出されました:
行 11:
E605: 例外が捕捉されませんでした: proc: vp_decode: ['/img_alt>園睚園瞞園眦園皹園盪 ^M^@<img_alt src="http://k.yimg.jp/images/clear.gif" title=""></img_alt> <img_alt src="http://k.yimg.jp/images/clear.gif" title=""></img_alt> <img_alt src="http://k.yimg.jp/images/clear.gif" title=""></img_alt> <img_alt src="http://k.yimg.jp/images/clear.gif" title=""></img_alt>^M^@<img_alt src="http://k.yimg.jp/images/clear.gif" title=""></img_alt> <img_alt src="http://k.yimg.jp/images/clear.gif" title=""></img_alt> ^M^@ <img_alt src="http://k.yimg.jp/images/top/sp/cgrade/icon_point.gif" title="堰、ゥ堰??堰ァ??a?園矍園皃園碯園睚園癇堰??奄附">堰、ゥ堰??堰ァ??a?園矍園皃園碯園睚園癇堰??奄附</img_alt><a href="r
function vimproc#system..63_system..63_read_pgroup の処理中にエラーが検出されました:
行 7:
E171: :endif がありません
function vimproc#system..63_system の処理中にエラーが検出されました:
行 49:
E171: :endif がありません
scp://形式のファイルを開こうとすると、以下のようにエラーが発生し、ファイルが開けませんでした。
(リモートホストはubuntuとし、ssh公開鍵認証設定済みです)
vim scp://ubuntu/.bashrc
Error detected while processing function <SNR>126_is_linux..unite#util#system..<SNR>26_system..vimproc#system..<SNR>127_system..vimproc#pgroup_open..<SNR>12
7_pgroup_open..vimproc#plineopen3..<SNR>127_plineopen..<SNR>127_convert_args..vimproc#get_command_name:
line 99:
E605: Exception not caught: vimproc#get_command_name: File "scp://ubuntu/script/locate" is not executable.
私のvimrcにはunite-locateが入っており、直接はその部分がトリガーとなってエラーになったように見えました。
(因みにリモートホスト側にはlocateコマンドも.bashrcも存在してます)
試しに、unite-locateをbundle配下から取り除いて(NeoBundleを使わせていただいてます)
同様に開いてみると、正しく参照出来るようになりました。
しかし、書き込みをしようとinsertモードに入ったタイミングで、
Error detected while processing function <SNR>230_check_source..<SNR>230_word_caching..neocomplcache#cache#async_load_from_file..<SNR>244_async_load..vimpro
c#system_bg..vimproc#popen3..<SNR>226_plineopen..<SNR>226_convert_args..vimproc#get_command_name:
line 99:
E605: Exception not caught: vimproc#get_command_name: File "scp://ubuntu/script/vim" is not executable.
のエラーが発生しました。
今度はunite-locateをbundle配下に戻し、vimprocを取り除いて同様のオペをすると正しく読み書き出来るようになりました。
上記事象から、vimprocに原因があるように思えるのですが、scp://形式のファイルはサポート対象外でしょうか?
現状だと開けなくなってしまうので、エラー時にはフォールバックするなどしていただけると非常に助かると思います。
よろしくお願いします。
Not sure the right place to ask a simple question. If there is a better place I will be happy to close this and ask there.
I am trying to execute a command and have the output populate a new buffer. I can do this synchronously with the following function, however I would like to have this work asynchronously. Populating the buffer while the command runs.
command! -complete=shellcmd -nargs=+ VimProcBackground call s:run_vimproc_background(<q-args>)
function! s:run_vimproc_background(cmdline)
let sub = vimproc#popen2(a:cmdline)
let res = ''
while !sub.stdout.eof
let res .= sub.stdout.read()
endwhile
let [cond, status] = sub.waitpid()
botright new
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
call append(0, split(res, '\r\n\|\r\|\n') + [string([cond, status])])
endfunction
How would I do that but have the command run in the background so I don't block the user?
I looked at the source for Unite, and I notice you are passing around a context
, but I don't fully understand what is going on. Any guidance would be great.
Thanks!
:99verbose VimProcBang ls
http://ow.ly/i/5rrG
I started working on this functionality, but wanted to ask before I sent a pull. We could have the Makefile
detect the platform and build appropriately. Or is there a reason to keep these in separate files?
Seems like it would be ideal to just run make
in the root of the directory for each platform.
vimprocをMSVC10.0 (VS2010) で 64bit向けにビルドすると、ビルド自体は成功しますが、使用時にエラーが出ます。
:VimProcBang echo を実行したときのエラーメッセージ
function <SNR>32_bang..vimproc#pgroup_open..<SNR>100_pgroup_open..vimproc#plineopen3..<SNR>100_plineopen..<SNR>100_vp_pipe_open..<SNR>100_libcall の処理中にエラーが検出されました:
行 4:
E364: "vp_pipe_open"() のライブラリ呼出に失敗しました
function <SNR>32_bang..vimproc#pgroup_open..<SNR>100_pgroup_open..vimproc#plineopen3..<SNR>100_plineopen..<SNR>100_vp_pipe_open の処理中にエラーが検出されました:
行 6:
E688: ターゲットがリスト型内の要素よりも多いです
行 13:
E121: 未定義の変数です: fdlist
E116: 関数の無効な引数です: len(fdlist)
E15: 無効な式です: a:npipe != len(fdlist)
行 19:
E121: 未定義の変数です: pid
E15: 無効な式です: [pid] + fdlist
function <SNR>32_bang..vimproc#pgroup_open..<SNR>100_pgroup_open..vimproc#plineopen3..<SNR>100_plineopen の処理中にエラーが検出されました:
行 74:
E714: リスト型が必要です
行 79:
(以下略)
I installed vimproc in Win7 64bit machine by Neobundle.vim and refer to :
"Windows 64bit でvimprocをコンパイルする | karakaram-blog" http://www.karakaram.com/vim/vimproc64/
And, I'm using neocomplcache, unite.vim, and "vimwiki". ( https://github.com/vim-scripts/vimwiki )
After opening vimwiki file (ex. :e hoge.viki), I open some file (ex. fuge.rb ), cause error:
function 82_check_source..82_word_caching..neocomplcache#cache#async_load_from_file..94_async_load..vimproc#get_command_name の処理中にエラーが検出されました:
行 15:E605: 例外が捕捉されませんでした: vimproc#get_command_name: File "gvim.exe" is not found.
function 82_check_source..82_word_caching..neocomplcache#cache#async_load_from_file..94_async_load の処理中にエラーが検出されました:
行 6:
E171: :endif がありません
function 82_check_source..82_word_caching の処理中にエラーが検出されました:
行 13:
E171: :endif がありません
function 82_check_source の処理中にエラーが検出されました:
行 12:
E171: :endif がありません
And after opening vimwiki file (ex. :e hoge.viki), I open some file (ex. fuge.rb ) with unite.vim, cause error:
function 82_check_source..82_word_caching..neocomplcache#cache#async_load_from_file..94_async_load..vimproc#get_command_name, 行 15
vimproc#get_command_name: File "gvim.exe" is not found.
Error occured in executing action!
Action name is open
These errors don't cause while no installing vimproc.
Vim 9.3.970以降で追加される新しい正規表現エンジンを使用すると、vimprocの挙動がおかしいという報告がいくつか上がっています。
ただし、上記のIssueは私の環境で再現していません。
私の環境では、vim-versionsを用いてコミットするときに固まるという現象が発生しました。
:set re=1
とすると発生せず。
-> vimproc関係ありませんでした
-> 7.3.1005で修正済み
Vim 7.3.1004で確認。
ここにもあるように、現在のvimprocは孫プロセスを削除できません。
neobundleのアップデートプロセスが孫プロセスを起動するのでゾンビプロセスとなり、問題となっています。
最近のコミットで対応を頑張ってみたものの、ちゃんと削除できていないようです。
これを一人でやるのは大変なので、詳しい人に手伝ってもらいたいと考えています。
確認方法:
:so vimproc.vim/tools/leak_check2.vim
[python] <defunct>
と表示されなければ成功、表示されると失敗(ゾンビプロセスが残っている)もしくは、vimproc, unite.vimがインストールされている状態で:Unite neobundle/update -log
を実行する。gitプロセスがゾンビになっていれば孫プロセスが削除されていない。
Ubuntu12.04でvim(7.3.429)を使っています。
vimprocをアップデートしたところ、"Please re-compile it."というエラーが表示されるようになってしまいました。
一度vimprocを再インストールして"make -f gcc_unix.mak"しなおしてみましたが、エラーは解消されませんでした。
また、vimshellは正常に動作するので、単にエラーメッセージだけ表示されてしまっているかんじです。
問題箇所は以下の部分です。
vimproc/autoload/vimproc.vim
1398: call s:print_error('Please re-compile it.')
現状cmd.exe
決め打ちになっている為、$PATH
上に別のcmd.exe
が存在したり、
Win3.1/95/98/MEで動作できません
(まぁ、そんな環境手持ちに有りませんが…)
なので$COMSPEC
を使用してみた
DeaR/vimproc.vim@7aff54c73e093f28b27cd280f09b2183c67ba047
しかし'shell'
の初期値や
http://perldoc.jp/docs/perl/5.16.1/perlrun.pod
デフォルトは WindowsNT では cmd.exe /x/d/c、Windows95 では command.com /c です。
COMSPEC の値はユーザーによってかなり様々で、移植性の問題を引き起こすので、 Perl はこの目的に COMSPEC は使わないことに注意してください。
といった表記を見かけてしまったのでhas('win16') || has('win95')
で分岐
DeaR/vimproc.vim@19cad4245cbe62a3768d0063d467493444bf610d
と2パターン弄ってみました
どうするのが良いですかね?
unite-locate plugin doesn't work on my environment (Gentoo Linux) because
vimproc#filepath#which()
checks if a command file is readable or not and
Gentoo's /usr/bin/locate
is unreadable.
I don't know why vimproc#filepath#which()
needs to confirm the readability.
Is it really necessary?
So we can use a shell script as the build command.
Not work in MSYS/MinTTY/Vim.
I use "make -f make_mingw32.mak" in cmd. I set "is_windows=1" and "is_cygwin=0"
Then I try use exemple:
Error detected while processing function vimproc#popen2..27_plineopen..27_convert_args..vimpro
c#get_command_name:
line 15:
E605: Exception not caught: vimproc#get_command_name: File "ls" is not found.
Error detected while processing function vimproc#popen2..27_plineopen:
line 52:
E170: Missing :endfor
Error detected while processing function vimproc#fopen..27_vp_file_open..27_libcall:
line 16:
E605: Exception not caught: vimproc: vp_file_open: ['open() error: No such file or directory']
Sorry for my English.
Vim にも neocomplcache も仕様通り(?)の動きをしているので厳密には不具合ではないかもしれませんが、
:e
の補完対象から実行ファイルを省く目的で、set wildignore+=*.exe
を設定していると、vimproc#util#expand()
に対し、*.exe を渡すとパスの展開をしなくなり、空文字列''
が返るようになります。
その結果、VimProcBang ls
はOKでVimProcBang ls.exe
でエラー出力されたり、vimshellのlsでエラー出力されたり、neocomplcacheの autocmd BufWirtePost に設定してある s:check_buffer() がエラーになったりします。
expand()
の第2引数に非ゼロの値を指定すれば wildignore を無視して展開してくれるようになるので、修正して頂けませんか?
diff --git a/autoload/vimproc/util.vim b/autoload/vimproc/util.vim
index 2ca2575..53607cd 100644
--- a/autoload/vimproc/util.vim
+++ b/autoload/vimproc/util.vim
@@ -58,7 +58,7 @@ function! vimproc#util#stderrencoding()"{{{
\ g:stderrencoding : vimproc#util#termencoding()
endfunction"}}}
function! vimproc#util#expand(path)"{{{
- return expand(escape(a:path, vimproc#util#is_windows() ? '*?"={}' : '*?"]'))
+ return expand(escape(a:path, vimproc#util#is_windows() ? '*?"={}' : '*?"]'), 1)
endfunction"}}}
function! vimproc#util#is_windows()"{{{
return s:is_windows
I am trying to install your vimshell. It tells me to install vimproc.
E216: No such group or event: filetypedetect *
Error occured while loading vimproc.
Please install vimproc Ver.6.0 or above.
Now I have the following in .vimrc.
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'mac' : 'make -f make_mac.mak',
\ },
\ }
Then I tried to build it according to your instruction.
~ make
make: *** No targets specified and no makefile found. Stop.
Now I am not sure how to build it. Any suggestions? Thanks in advance.
alpaca_tags(developmentブランチ)にて、vimprocを使っています。
その中でエラーが出ることがあるのですが、どうやらvimprocの分かりにくいバグのような気がします。
vimprocの内部構造が複雑なので、何かアタリをつけて調べたいです。アドバイスをお願いします。
発生状況
augroup
とautocmd
を生成する。そして、CursorHold
のタイミングでジョブが完了したか確認している。バグの原因の予想
お手数ですが、よろしくお願いします。
Error detected while processing function alpaca_tags#create_tags#update..alpaca_tags#util#system..vim
proc#popen2..<SNR>146_plineopen..<SNR>146_convert_args..vimproc#get_command_name:
line 15:
E605: Exception not caught: vimproc#get_command_name: File "/Users/alpaca/.bundle/alpaca_tags_develop
ment/bin/create_tags_into_git" is not found.
Error detected while processing function alpaca_tags#create_tags#update..alpaca_tags#util#system..vim
proc#popen2..<SNR>146_plineopen:
line 52:
E170: Missing :endfor
Error detected while processing function alpaca_tags#create_tags#update..alpaca_tags#util#system:
line 10:
E171: Missing :endif
※もちろん、表示されているファイルは存在します。
Is this possible, I tried an example such as this but it is not working:
let sub = vimproc#system_bg('sh')
call sub.stdin.write('echo hi')
let res = ''
let end = localtime() + 2
while !sub.stdout.eof && end > localtime()
let res .= sub.stdout.read()
endwhile
let [cond, status] = sub.waitpid()
echo res
echo cond
echo status
Windows の場合に参照している引数 filename の参照時に a: が抜けててエラーが出まする。
https://github.com/Shougo/vimproc/blob/master/autoload/vimproc.vim#L806
I get these warnings under gcc 4.7.2 but vimproc still compiles & works fine. 😅
$ make
make -f make_unix.mak
make[1]: Entering directory '/home/cadror/.vim/bundle/vimproc'
gcc -W -O2 -Wall -Wno-unused -std=gnu99 -pedantic -shared -fPIC -o autoload/vimproc_unix.so autoload/proc.c -lutil
autoload/proc.c: In function ‘vp_dlversion’:
autoload/proc.c:162:20: warning: unused parameter ‘args’ [-Wunused-parameter]
vp_dlversion(char *args)
^
In file included from /usr/include/fcntl.h:38:0,
from autoload/proc.c:27:
autoload/proc.c: At top level:
/home/utils/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed/sys/stat.h:379:16: warning: inline function ‘mknod’ declared but never defined [enabled by default]
__inline__ int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
^
/home/utils/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed/sys/stat.h:379:16: warning: inline function ‘mknod’ declared but never defined [enabled by default]
make[1]: Leaving directory '/home/cadror/.vim/bundle/vimproc'
vimfiler + vimshellを使用中に以下のエラーが出ました。
エラーの内容にvimprocとありましたのでこちらに報告します。
function <SNR>216_check_all_output..<SNR>216_check_output..<SNR>107_vp_set_winsize..vimproc#kill の処理中にエラーが検出されました:
行 8:
E688: ターゲットがリスト型内の要素よりも多いです
function <SNR>216_check_all_output..<SNR>216_check_output..<SNR>107_vp_set_winsize の処理中にエラーが検出されました:
行 23:
E170: :endfor がありません
function <SNR>216_check_all_output..<SNR>216_check_output の処理中にエラーが検出されました:
行 77:
E171: :endif がありません
function <SNR>216_check_all_output の処理中にエラーが検出されました:
行 12:
E171: :endif がありません
vimfiler, vimshell, vimproc最新版です。
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 9 2012 22:42:34)
MacOS X (unix) 版
適用済パッチ: 1-515
よろしくお願い申し上げます。
Vim起動からの操作
echo vimproc#version()
結果
画面がredrawされ, vimproc#version() の結果が見えない.
「VIM - Vi IMproved」の文字も消える.
期待する挙動
redrawされずにロードでき, vimprocのバージョンも表示される.
再現vimrc
set nocompatible
filetype off
execute 'set runtimepath+='.expand('~/.vim/bundle/neobundle.vim')
call neobundle#rc(expand('~/.vim/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc'
syntax enable
set laststatus=2
filetype plugin indent on
Vimのバージョン 7.4.131 端末です
http://lingr.com/room/vim/archives/2013/04/25#message-14983284
system だと GUI が起動し、出力結果を取得できるんですが、vimproc だとそもそも GUI が起動しないのでどうしたものかなーと。
いや、そうでもなかった。echo vimproc#system("cmd /c window.exe")
で動作した。
http://lingr.com/room/vim/archives/2013/04/25#message-14983639
なんとなくわかりました。明日時間があったらvimproc見てみますが、cmdで行けるならその方向で。
前々から問題は認識していましたが、原因と(対処できるなら)対処方法について調べてみたいと思っています。何か情報がありましたらよろしくおねがいします。
My system environment is:
Arch Linux (latest)
Vim version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 8 2012 16:47:21)
Included patches: 1-754
Compiled by ArchLinux
Big version with GTK2 GUI. Features included (+) or not (-):
function <SNR>280_vp_dlopen..<SNR>280_libcall, line 4
Vim(let):dlerror = "/home/chris/Git/dotfiles/.vim/bundle/vimproc/autoload/vimproc_unix.so: wrong ELF class
: ELFCLASS32"
Error occured in source's initialize()!
Source name is buffer_complete
-------------------------------------------------
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..vimproc#system_bg..vimproc#popen3..<SNR>280_plineopen..<SNR>280_vp_pipe_open.
.<SNR>280_libcall:
line 4:
dlerror = "/home/chris/Git/dotfiles/.vim/bundle/vimproc/autoload/vimproc_unix.so: wrong ELF class: ELFCLAS
S32"
E364: Library call failed for "vp_pipe_open()"
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..vimproc#system_bg..vimproc#popen3..<SNR>280_plineopen..<SNR>280_vp_pipe_open:
line 9:
E688: More targets than List items
line 13:
E121: Undefined variable: fdlist
E116: Invalid arguments for function len(fdlist)
E15: Invalid expression: a:npipe != len(fdlist)
line 19:
E121: Undefined variable: pid
E15: Invalid expression: [pid] + fdlist
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..vimproc#system_bg..vimproc#popen3..<SNR>280_plineopen:
line 74:
E714: List required
line 79:
E121: Undefined variable: pid
E116: Invalid arguments for function add
line 80:
E121: Undefined variable: fd_stdin
E116: Invalid arguments for function s:fdopen(fd_stdin, 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write')
E15: Invalid expression: s:fdopen(fd_stdin, 'vp_pipe_close', 'vp_pipe_read', 'vp_pipe_write')
E116: Invalid arguments for function add
line 97:
E684: list index out of range: -1
E15: Invalid expression: stdout_list[-1].fd
line 103:
E684: list index out of range: -1
E15: Invalid expression: pid_list[-1]
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..vimproc#system_bg..<SNR>280_close_all..<SNR>280_close..<SNR>280_vp_pipes_fron
t_close:
line 1:
E684: list index out of range: 0
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..vimproc#system_bg..<SNR>280_close_all..<SNR>280_close..<SNR>280_vp_pipes_back
_close:
line 1:
E684: list index out of range: 0
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..vimproc#system_bg:
line 11:
E716: Key not present in Dictionary: pid
E15: Invalid expression: subproc.pid
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..<SNR>278_async_load..vimproc#system_bg..vimproc#popen3..<SNR>280_plineopen..<
SNR>280_vp_pipe_open..<SNR>280_libcall:
line 4:
dlerror = "/home/chris/Git/dotfiles/.vim/bundle/vimproc/autoload/vimproc_unix.so: wrong ELF class: ELFCLAS
S32"
E364: Library call failed for "vp_pipe_open()"
Error detected while processing function <SNR>285_check_buffer..<SNR>285_initialize_include..neocomplcache
#cache#async_load_from_tags..<SNR>278_async_load..vimproc#system_bg..vimproc#popen3..<SNR>280_plineopen..<
SNR>280_vp_pipe_open:
I have traced a delay (~5 seconds) in closing gvim on Windows when I run any command using vimproc#cmd#system()
. I have traced it to the s:close() command in cmd.vim that is tied to the VimLeave autocommand. I haven't recompiled the vimproc dll in a month or so, would this be the root cause, or is this behavior expected?
Reason is this issue request:
MarcWeber/vim-addon-manager-known-repositories#62
For vim-addon-async it works great: if the target executable does not exist yet ask the user whether "gcc" should be run for him. If he says [y], then it gets compiled automatically and everything works.
I'd prefer the plugin being that smart rather than making vim-addon-manager run make on behalf of the user (or tell him that he should do so.) Tools like neobundle would benefit, too.
How do you think about it?
以前は動作していたはずなんですが、最新版で確認したところ、次の単純なコマンドが動作していなくなっていました。
ちなみに、Linuxでは動作することを確認済み。
% ls | cat
!!!"C:/Program Files (x86)/Git/bin/cat.exe": -: Bad file number!!!
!!!"C:/Program Files (x86)/Git/bin/cat.exe": -: Bad file number!!!
!!!!!!!!!vimshell: exit 1 "ls|cat"!!!
Windows 7 64bit環境の32bit GVim上で確認。
Bad file numberについては、Webを参照したところ、
http://docs.oracle.com/cd/E19455-01/806-2720/msgs-91/index.html
ファイル記述子がオープンファイル以外を参照しているか、または書き込み (または読み取り) 専用に開かれたファイルに対して read(2) - または write(2) - 要求が実行されました。
ということらしいです。
catに渡されているファイル記述子(パイプ)がおかしいのだと思いますが、ソースコードを読んでいてもどこがおかしいのかわかりません。原因がつかめないため、こうしてIssuesに登録することにしました。Windowsのプロセス管理に詳しい人(特にmattnさん)にコードをチェックして欲しいのですが……。C言語側のソースコード(autoload/proc_w32.c)が悪いのはほぼ間違い無いです。
ちなみに、vimshellからプログラムの出力が読めるし、入出力のリダイレクションも動作することは確認済みです。
4cf58e0 で vimproc#get_last_errmsg() が機能しなくなっています.
処理を追えてませんが,とりあえず1012行目を
if self.proc.current_proc.stdout.eof && self.proc.current_proc.stderr.eof
に戻すと大丈夫でした.
VimProcで外部コマンドが実行されるとき、そのコマンドのエコーが縦一列に表示されます。
:VimProcBang ls -al
とすると、
l
s
-
a
ltotal 1168
drwxr-xr-x+ 148 sunvisor staff 5032 10 27 11:44 .
drwxr-xr-x 6 root admin .....
のようになります。
これは、VimShellで実行したときにもなり、
のような表示になります。
最初の実行の時にはステータス画面は、すぐに消えるのですが2度目からは消えません。
また、NeoBundleにおいても、このように実行されたコマンド名が縦にエコーされます。
.vimrcをほとんどからにしてから実行しても症状がとまりませんでした。
当方の環境は、
OS: OS X 10.8.2
Vim: MacVim 7.3(KaoriYa 20120823)
です。コマンドライン版の 7.3 でも同様の事象が発生します。
Visual C++ では snprintf()
関数が提供されていないため、ビルドエラーになります。
proc_w32.c に ↓ を追加してビルドできることは確認しました。
#ifdef _MSC_VER
# define snprintf _snprintf
#endif
関数の挙動を考えると _snprintf_s
を使用した方がよいかもしれませんが、引数が snprintf
と異なるため
単純な置きかえはできません。
7bbe961 において追加された Ignore tty 処理で使われている TIOCNOTTY
が Cygwin には無いためコンパイルエラーとなります。
同じようなことで修正されてるソースがあったので以下の様にしてみました。
これで以下の環境で動作しています。
--- a/autoload/proc.c
+++ b/autoload/proc.c
@@ -486,6 +486,9 @@ vp_pipe_open(char *args)
}
{
+#ifdef __CYGWIN__
+ setsid();
+#else
/* Ignore tty. */
char name[L_ctermid];
if (ctermid(name)[0] != '\0') {
@@ -495,6 +498,7 @@ vp_pipe_open(char *args)
close(tfd);
}
}
+#endif
}
argv = malloc(sizeof(char *) * (argc+1));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.