system()
code:vim
:let out = system("echo hello")
:echo out
結果
code:結果
hello
call('system', 引数)のようにもできる
Encapsulate system() plus v:shell_error · tpope/vim-fugitive@39087fe
code:vim
let out = call('system', "echo hello")
echo out
結果
code:結果
hello
callを使う方法はvim-jpにも書いてあった!
https://vim-jp.slack.com/archives/CJMV3MSLR/p1566032524075700
https://gyazo.com/f9019b0c3028a732ee5edf12cfc7112d
コマンドへの標準入力をバッファの内容にしたい
ただたんに取得して、渡すしか無いのかな
2019/8/24 21:40
以下の関数でカレントバッファのテキストは取得できる
code:vim
function! s:get_cur_buf_lines() abort
return join(getline(1, '$'), "\n")
endfunction
asyncomplete-buffer.vimこの書き方してた
https://github.com/prabirshrestha/asyncomplete-buffer.vim/blob/b8f00ea28c29d776148b3380df8f739b67696f68/autoload/asyncomplete/sources/buffer.vim#L68