tweetvim 自動更新
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
" 自動更新間隔(秒) | |
let s:tweetvim_update_interval_seconds = 60 | |
let s:tweetvim_timestamp = reltime()[0] | |
function! s:tweetvim_autoupdate() | |
let current = reltime()[0] | |
if current - s:tweetvim_timestamp > s:tweetvim_update_interval_seconds | |
call feedkeys("\<Plug>(tweetvim_action_reload)") | |
let s:tweetvim_timestamp = current | |
endif | |
call feedkeys(mode() ==# 'i' ? "\<C-g>\<ESC>" : "g\<ESC>", 'n') | |
endfunction | |
function! s:tweetvim_setup_autoupdate() | |
augroup vimrc-tweetvim-autoupdate | |
autocmd! | |
autocmd CursorHold * call <SID>tweetvim_autoupdate() | |
augroup END | |
endfunction | |
" 自動更新開始と終了用コマンド | |
command! -nargs=0 TweetVimAutoUpdate call <SID>tweetvim_setup_autoupdate() | |
command! -nargs=0 TweetVimStopAutoUpdate autocmd! vimrc-tweetvim-autoupdate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment