thinca / vim-quickrun

Run commands quickly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(Question) FSharp REPL can not work well at runner/concurrent_process

callmekohei opened this issue · comments

Hello! I'm callmekohei!

(Japanese script)

Problems summary

F# REPLがうまくrunnerとして働かない

Expected

F# REPLがうまくrunnerとして働らく

Environment Information

  • vim-quickrun version(SHA1):
98889e1 Tue Mar 21 21:25:36 2017 +0900 Add "kotlin/concurrent_process" config  (HEAD -> master, origin/master, origin/HEAD)
  • OS:
~$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.12.5
BuildVersion:	16F73
~$ uname -v
Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64
  • neovim version:
~$ nvim -v
NVIM v0.2.0

init.vim(toml)

[[plugins]]
repo = 'Shougo/vimproc.vim'
build = 'make'

[[plugins]]
repo = 'thinca/vim-quickrun'
hook_add = '''
    set splitright
    let g:quickrun_config = {
    \
    \   'fsharp' : {
    \       'command': 'fsharpi',
    \       'exec': '%c',
    \       'tempfile': '%{tempname()}.fsx',
    \       'runner': 'concurrent_process',
    \       'runner/concurrent_process/load': ':load %S;;',
    \       'runner/concurrent_process/promt': '> ',
    \   },
    \ }
'''

FSharp repl( fsharpi )

$ fsharpi 

F# Interactive for F# 4.1
Freely distributed under the Apache 2.0 Open Source License

For help type #help;;

> "hello" |> printfn "%A";;
"hello"
val it : unit = ()

> #quit;;

- Exit...
$ 

Others

お忙しいところすみません。。。

色々やってみたのですが、できませんでした(^_^;;

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 14 2017 10:56:08)
Included patches: 1-329
Compiled by Arch Linux
Huge version with GTK2 GUI.  Features included (+) or not (-):

にて、以下の設定で動きました。

let g:quickrun_config['fsharp'] = {
  \ 'command': 'fsharpi',
  \ 'tempfile': '%{tempname()}.fsx',
  \ 'runner' : 'concurrent_process',
  \ 'runner/concurrent_process/load': '#load "%S";;',
  \ 'runner/concurrent_process/prompt': '> ',
  \ }

raa0121さん!ありがとうございます!

早速やってみたのですが、、、僕の環境だと動かないです (^_^;;

vimでやってみましたがこちらも動かない・・・。

Documents$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 18 2017 11:27:19)
MacOS X (unix) version
Included patches: 1-728
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      -terminal
++builtin_terms  +fork()          +multi_lang      +terminfo
+byte_offset     -gettext         -mzscheme        +termresponse
+channel         -hangul_input    +netbeans_intg   +textobjects
+cindent         +iconv           +num64           +timers
-clientserver    +insert_expand   +packages        +title
+clipboard       +job             +path_extra      -toolbar
+cmdline_compl   +jumplist        +perl            +user_commands
+cmdline_hist    +keymap          +persistent_undo +vertsplit
+cmdline_info    +lambda          +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      +startuptime     -xpm
+eval            +mouse_dec       +statusline      -xsmp
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_clipboard
+extra_search    -mouse_jsbterm   +syntax          -xterm_save
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.26.0/lib/perl5/5.26.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/opt/python/Frameworks -framework Python   -lruby.2.4.1 -lobjc    

g:quickrun_config にミスがあります

  \ 'runner/concurrent_process/load': '#load "%S";;',
  \ 'runner/concurrent_process/prompt': '> ',

この2項目を見直してみてください。

raa0121さん!ありがとうございます!

ふむ〜。やってみたのですがやっぱりダメです・・・。

プロセスは立ち上がってるのですが、ただそれだけみたいな感じです (^_^;;

[[plugins]]
repo = 'thinca/vim-quickrun'
hook_add = '''
set splitright
let g:quickrun_config = {
  \ 'fsharp' : {
      \ 'command' : 'fsharpi',
      \ 'tempfile': '%{tempname()}.fsx',
      \ 'runner'  : 'concurrent_process',
      \ 'runner/concurrent_process/load'  : '#load "%S";;',
      \ 'runner/concurrent_process/prompt': '> ',
  \ }
\ }
'''
NVIM 0.1.7
Build type: Release

で、https://github.com/callmekohei/nvim をもとに、上記の設定とvimproc.vim のインストール設定を追加して、実施したところ、正しく実行されました。

MacVim の問題かと思われます

raa0121さん!ありがとうございます (^_^)/

MacNeovim だとだめそうなんですね!

ちなみにversion 0.1.7に変更してみましたがダメでした・・・。

ふむ〜 (^_^;;

Documents$ brew unlink neovim
Unlinking /usr/local/Cellar/neovim/0.2.0_1... 31 symlinks removed
Documents$ brew switch neovim 0.1.7
Cleaning /usr/local/Cellar/neovim/0.1.7
Cleaning /usr/local/Cellar/neovim/0.2.0
Cleaning /usr/local/Cellar/neovim/0.2.0_1
Cleaning /usr/local/Cellar/neovim/HEAD-df1e7b7
31 links created for /usr/local/Cellar/neovim/0.1.7
Documents$ nvim --version
NVIM 0.1.7
Build type: RelWithDebInfo

切り分けのために最小セットで立ち上げてみました

最小限のvim.rc

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"                              minimal init.vim                              "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

set runtimepath+=~/.config/nvim/vim-quickrun

filetype plugin indent on
syntax enable

let g:python_host_prog  = '/usr/local/bin/python2.7'
let g:python3_host_prog = '/usr/local/bin/python3.6'

set splitright
let g:quickrun_config = {
  \ 'fsharp' : {
      \ 'command' : 'fsharpi',
      \ 'tempfile': '%{tempname()}.fsx',
      \ 'runner'  : 'concurrent_process',
      \ 'runner/concurrent_process/load'  : '#load "%S";;',
      \ 'runner/concurrent_process/prompt': '> ',
  \ }
\ }

echom "minimal vimrc loaded"

たちあげ

$ vim -u minit.vim abc.fsx
minimal vimrc loaded
続けるにはENTERを押すかコマンドを入力してください

しかしQuickrunコマンドがでてこず失敗・・・

なぜに??

最低限の構成(下記)でやってみましたが同じでした・・・(^_^;;

dein
vim-quickrun
vimproc.vim

まとめ

Mac OS X のNeovim, Vimでは動かない??

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.12.5
BuildVersion:	16F73

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 18 2017 11:27:19)
MacOS X (unix) version

$ nvim --version
NVIM v0.2.0
Build type: Release
commented

本日の vimrc 読書会のあとで検証した結果を貼っておきます。

https://gitter.im/vim-jp/reading-vimrc?at=597ca12fbc4647297436d909

Linux では raa さんが貼ってくれた vimrc で問題なく動作した。(mattn)
Linux 版では

echo '#load "foo.fsx";;' | fsharpi

で動作するが、OSX 版だと動作しない。

issue書いてみました!

dotnet/fsharp#3418

解決しました!

osxでは--readline-というオプションをつけると動きます!

    \     , 'fsharp/concurrent_process' : {
    \           'command'                         : 'fsharpi --readline-'
    \         , 'tempfile'                        : '%{tempname()}.fsx'
    \         , 'runner'                          : 'concurrent_process'
    \         , 'runner/concurrent_process/load'  : '#load "%S";;'
    \         , 'runner/concurrent_process/prompt': '> '
    \     }

参考:
https://stackoverflow.com/questions/7217106/how-to-use-stdin-pipe-with-fsharpi-fsi-and-mono?rq=1

https://msdn.microsoft.com/ja-jp/library/dd233172(v=vs.110).aspx

dotnet/fsharp#3418

解決しましたのでissuecloseします (^_^)/