Last active
June 17, 2016 15:23
-
-
Save miyakogi/28b16449b90fdf11d36e815ac7724ad4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:tm(timer) abort | |
" 何か時間のかかる処理 | |
for i in range(1000) | |
let a = 1 | |
endfor | |
if job_status(get(s:, 'job')) !=# 'run' | |
call timer_stop(a:timer) | |
endif | |
endfunction | |
let s:options = { | |
\ 'out_mode': 'raw', | |
\ 'err_mode': 'raw', | |
\ 'out_io': 'buffer', | |
\ 'err_io': 'buffer', | |
\ 'out_name': 'output', | |
\ 'err_name': 'output', | |
\ } | |
function! Job() abort | |
let s:job = job_start(['python', 'job.py'], s:options) | |
" 環境によっては3msだと短すぎてVimが応答しなくなるかもなので調整して下さい | |
call timer_start(3, function('s:tm'), {'repeat': -1}) | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for _ in range(10000): | |
print('.', end='', flush=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim a.vim | |
:so % | |
:call Job() | |
:buffer output | |
改行がたくさん入っていてつらいので連結 | |
ggVGgJ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
「手順」の最後
ggVGgJ
は:%j!
でも可です。