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/status auto completion #18

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ __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\_statusAutoCompletion = (0 or 1), default is 1

# Hacking

* Keep all lines to 80 characters wide or less
* All python code should follow pep8 guidelines
* All new features should update documentation in the README


# Contributors

* Philipp [philsmd](https://github.com/philsmd)
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_statusAutoCompletion = (0 or 1) default is 1

python <<EOF
try:
Expand Down Expand Up @@ -1458,9 +1459,23 @@ class VimChatScope:
vim.command('normal G')

def setStatus(self, status=None):
if not self.accounts:
print "Not Connected! Please connect first."
return 0
if not status:
statusCompletion = ''
if int(vim.eval("g:vimchat_statusAutoCompletion"))==1:
firstAccount = self.accounts.itervalues().next()
if firstAccount != None:
[oldShow,oldStatus] = firstAccount.jabberGetPresence()

if oldShow != None and str(oldShow) != "None":
statusCompletion = str(oldShow)
if oldStatus != None and str(oldStatus) != "None":
statusCompletion += ','+str(oldStatus)
status = str(vim.eval(
'input("Status: (away,xa,dnd,chat),message,priority: ")'))
'input("Status: (away,xa,dnd,chat),message,priority: ",'+
'"'+statusCompletion+'")'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you indent this last line? Whenever you break up a line, you should indent any lines after the first one.


parts = status.split(',')
show = parts[0]
Expand Down Expand Up @@ -1727,6 +1742,9 @@ fu! VimChatCheckVars()
if !exists('g:vimchat_showPresenceNotification')
let g:vimchat_showPresenceNotification=""
endif
if !exists('g:vimchat_statusAutoCompletion')
let g:vimchat_statusAutoCompletion=1
endif

return 1
endfu
Expand Down