Skip to content

Instantly share code, notes, and snippets.

@syui
Created August 26, 2014 16:02
Show Gist options
  • Save syui/b1ed642eb3757d3c650b to your computer and use it in GitHub Desktop.
Save syui/b1ed642eb3757d3c650b to your computer and use it in GitHub Desktop.
let s:tweetvim_notfiy_update_interval_seconds = 2
let s:tweetvim_notfiy_timestamp = reltime()[0]
let s:tweetvim_notfiy_getline_1 = getline(3)
fu! s:tweetvim_notfiy()
let n_current = reltime()[0]
if n_current - s:tweetvim_notfiy_timestamp > s:tweetvim_notfiy_update_interval_seconds
if s:tweetvim_notfiy_getline_1 != getline(3)
let s:tweetvim_notfiy_getline_1 = getline(3)
call system("growlnotify -m '" . getline(3) . "'")
end
let s:tweetvim_notfiy_timestamp = n_current
end
endf
fu! s:tweetvim_notfiy_setup_autoupdate()
aug vimrc-tweetvim-notfiy-autoupdate
au!
au CursorHold * call <SID>tweetvim_notfiy()
aug END
endf
com! -nargs=0 TweetVimStartNotify call <SID>tweetvim_notfiy_setup_autoupdate()
com! -nargs=0 TweetVimStopNotfiy au! vimrc-tweetvim-notfiy-autoupdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment