diff --git a/README.md b/README.md index 0560de4..684e284 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ __Optional ~/.vimrc Variables:__ * let g:vimchat\_buddylistmaxwidth = max width of buddy list window, default '' * let g:vimchat\_timestampformat = format of the message timestamp, default "[%H:%M]" * let g:vimchat\_showPresenceNotification = notification if buddy changed status, comma-separated list of states, default "" +* let g:vimchat\_autoLogin = (0 or 1), default is 0 # Hacking diff --git a/plugin/vimchat.vim b/plugin/vimchat.vim index 4ab3c36..ff66c3b 100644 --- a/plugin/vimchat.vim +++ b/plugin/vimchat.vim @@ -30,6 +30,7 @@ " g:vimchat_timestampformat = format of the msg timestamp default "[%H:%M]" " g:vimchat_showPresenceNotification = " notify if buddy changed status default "" +" g:vimchat_autoLogin = (0 or 1) default is 0 python <<EOF try: @@ -1736,6 +1737,23 @@ function! VimChatFoldText() let line=strpart(' ', 0, (v:foldlevel - 1)).substitute(line,'\s*{\+\s*', '', '') return line endfunction -"}}} + +" AutoLogin +" Default value for autoLogin is 0 (disabled) +if !exists('g:vimchat_autoLogin') + let g:vimchat_autoLogin=0 +endif +if g:vimchat_autoLogin == 1 + augroup vimchat_autoload + autocmd TermResponse * call VimChatAutoload() + augroup END + + fun! VimChatAutoload() + py VimChat.init() + " the following commands disable the autocmd after the first run + autocmd! vimchat_autoload + augroup! vimchat_autoload + endfun +endif " vim:et:fdm=marker:sts=4:sw=4:ts=4