Skip to content

Instantly share code, notes, and snippets.

@syui
Created November 3, 2013 13:05
Show Gist options
  • Save syui/7290096 to your computer and use it in GitHub Desktop.
Save syui/7290096 to your computer and use it in GitHub Desktop.
"" 一番上(3行目)のツイートを通知する
"" https://gist.github.com/rhysd/4201877
"" NeoBundle 'supermomonga/shiraseru.vim'
" 自動更新間隔(秒)
let s:tweetvim_update_interval_seconds_growl = 4
let s:tweetvim_timestamp_growl = reltime()[0]
function! s:tweetvim_autoupdate_growl()
let current = reltime()[0]
if current - s:tweetvim_timestamp_growl > s:tweetvim_update_interval_seconds_growl
call feedkeys("\<Plug>(tweetvim_action_reload)\<CR> 3GY :call shiraseru#notify(system('pbpaste'))\<CR>")
let s:tweetvim_timestamp_growl = current
endif
call feedkeys(mode() ==# 'i' ? "\<C-g>\<ESC>" : "g\<ESC>", 'n')
endfunction
function! s:tweetvim_setup_autoupdate_growl()
augroup vimrc-tweetvim-autoupdate-growl
autocmd!
autocmd CursorHold * call <SID>tweetvim_autoupdate_growl()
augroup END
endfunction
" 自動更新開始と終了用コマンド
command! -nargs=0 TweetVimAutoUpdateGrowl call <SID>tweetvim_setup_autoupdate_growl()
command! -nargs=0 TweetVimStopAutoUpdateGrowl autocmd! vimrc-tweetvim-autoupdate-growl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment