Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created December 4, 2012 08:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rhysd/4201877 to your computer and use it in GitHub Desktop.
tweetvim 自動更新
" 自動更新間隔(秒)
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