kawarimidoll / autoplay.vim

Operate Vim automatically 🛼

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autoplay.vim

Operate Vim automatically 🛼

autoplay_demo.mp4

example

call autoplay#reserve({
    \ 'wait': 40,
    \ 'spell_out': 1,
    \ 'logger': {item -> execute('echomsg ' .. string(item), '')},
    \ 'scripts': [
    \   "iHello world!\<esc>",
    \ ],
    \ })

nnoremap # <cmd>call autoplay#run()<cr>
augroup autoplay-demo
  autocmd!
  autocmd User autoplay_start echomsg 'autoplay start!'
  autocmd User autoplay_finish echomsg 'autoplay finish!'
augroup END

call autoplay#reserve({
    \ 'wait': 50,
    \ 'spell_out': v:true,
    \ 'remap': v:false,
    \ 'logger': {item, script -> writefile([string(script) .. ' ' .. item], './autoplay.log', 'a')},
    \ 'scripts': [
    \   'iThis line is displayed one character ',
    \   { 'text':"at a time!\<esc>", 'spell_out': v:true },
    \   { 'wait': 800 },
    \   { 'text':"oThis line is displayed at a time!\<cr>", 'wait': 800 },
    \   'Today: ',
    \   { 'expr': 'strftime', 'args': ['%Y/%m/%d'] , 'wait': 800 },
    \   "\<cr>normal command also works.\<esc>",
    \   { 'exec': 'normal! v3k5>' },
    \   'ODelay time ...',
    \   { 'wait': 800 },
    \   { 'text': repeat("\<bs>", 3) .. 'can also ...', 'wait': 100, 'spell_out': v:true },
    \   { 'wait': 800 },
    \   { 'text': repeat("\<bs>", 3) .. "be modified.\<cr>", 'wait': 200, 'spell_out': v:true },
    \   { 'text': "This line will be changed by `setline`.\<esc>", 'wait': 1000 },
    \   { 'call': 'setline', 'args': ['.', '3'], 'wait': 1000 },
    \   { 'call': 'setline', 'args': ['.', '2'], 'wait': 1000 },
    \   { 'call': 'setline', 'args': ['.', '1'], 'wait': 1000 },
    \   { 'call': 'setline', 'args': ['.', 'done!'] }
    \ ],
    \ })

call autoplay#run()

About

Operate Vim automatically 🛼

License:MIT License


Languages

Language:Vim Script 100.0%