@register(u'delete-horizontal-space')
def delete_horizontal_space(event):
 buff = event.current_buffer
 text_before_cursor = buff.document.text_before_cursor
 text_after_cursor = buff.document.text_after_cursor
 delete_before = (len(text_before_cursor) - len(text_before_cursor.rstrip(u' DCTB  ')))
 delete_after = (len(text_after_cursor) - len(text_after_cursor.lstrip(u' DCTB  ')))
 buff.delete_before_cursor(count=delete_before)
 buff.delete(count=delete_after)

@ register ( u'delete-horizontal-space' ) def delete_horizontal_space ( event ) : buff = event . current_buffer text_before_cursor = buff . document . text_before_cursor text_after_cursor = buff . document . text_after_cursor delete_before = ( len ( text_before_cursor ) - len ( text_before_cursor . rstrip ( u' DCTB  ' ) ) ) delete_after = ( len ( text_after_cursor ) - len ( text_after_cursor . lstrip ( u' DCTB  ' ) ) ) buff . delete_before_cursor ( count = delete_before ) buff . delete ( count = delete_after )
delete all spaces and tabs around point .