Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/auto login on vim start #16

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 19 additions & 1 deletion plugin/vimchat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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