@register(u'insert-comment')
def insert_comment(event):
 buff = event.current_buffer
 if (event.arg != 1):
  def change(line):
   return (line[1:] if line.startswith(u'#') else line)
 else:
  def change(line):
   return (u'#' + line)
 buff.document = Document(text=u'\n'.join(map(change, buff.text.splitlines())), cursor_position=0)
 buff.accept_action.validate_and_handle(event.cli, buff)

@ register ( u'insert-comment' ) def insert_comment ( event ) : buff = event . current_buffer if ( event . arg != 1 ) : def change ( line ) : return ( line [ 1 : ] if line . startswith ( u'#' ) else line ) else : def change ( line ) : return ( u'#' + line ) buff . document = Document ( text = u'\n' . join ( map ( change , buff . text . splitlines ( ) ) ) , cursor_position = 0 ) buff . accept_action . validate_and_handle ( event . cli , buff )
without numeric argument .