def register(self):
		u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		# an Action menu entry which binds "keybinding" to action ":action"
		settings.set(u'org_tag_column', u'77')

		settings.set(u'org_tag_completion_ignorecase', int(vim.eval(u'&ignorecase')))

		self.keybindings.append(Keybinding(u'<localleader>st', Plug(u'OrgSetTags', u':py ORGMODE.plugins[u"TagsProperties"].set_tags()<CR>')))
		self.menu + ActionEntry(u'Set &Tags', self.keybindings[-1])

		self.commands.append(Command(u'OrgTagsRealign', u":py ORGMODE.plugins[u'TagsProperties'].realign_all_tags()"))

		# workaround to align tags when user is leaving insert mode
		vim.command(u"""function Org_complete_tags(ArgLead, CmdLine, CursorPos)
python << EOF
ORGMODE.plugins[u'TagsProperties'].complete_tags()
EOF
if exists('b:org_complete_tags')
	let tmp = b:org_complete_tags
	unlet b:org_complete_tags
	return tmp
else
	return []
endif
endfunction""".encode(u'utf-8'))

		# this is for all org files opened after this file
		vim.command(u"au orgmode FileType org :au orgmode InsertLeave <buffer> :py ORGMODE.plugins[u'TagsProperties'].realign_tags()".encode(u'utf-8'))

		# this is for the current file
		vim.command(u"au orgmode InsertLeave <buffer> :py ORGMODE.plugins[u'TagsProperties'].realign_tags()".encode(u'utf-8'))
Beispiel #2
0
    def register(self):
        u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
        self.keybindings.append(
            Keybinding(
                u'<localleader>ct',
                Plug(
                    u'OrgTodoToggleNonInteractive',
                    u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(interactive=False)<CR>'
                )))
        self.menu + ActionEntry(u'&TODO/DONE/-', self.keybindings[-1])

        # add submenu
        submenu = self.menu + Submenu(u'Select &keyword')

        self.keybindings.append(
            Keybinding(
                u'<S-Right>',
                Plug(u'OrgTodoForward',
                     u':py ORGMODE.plugins[u"Todo"].toggle_todo_state()<CR>')))
        submenu + ActionEntry(u'&Next keyword', self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                u'<S-Left>',
                Plug(
                    u'OrgTodoBackward',
                    u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(direction=2)<CR>'
                )))
        submenu + ActionEntry(u'&Previous keyword', self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                u'<C-S-Right>',
                Plug(
                    u'OrgTodoSetForward',
                    u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(next_set=True)<CR>'
                )))
        submenu + ActionEntry(u'Next keyword &set', self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                u'<C-S-Left>',
                Plug(
                    u'OrgTodoSetBackward',
                    u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(direction=2, next_set=True)<CR>'
                )))
        submenu + ActionEntry(u'Previous &keyword set', self.keybindings[-1])

        settings.set(u'org_todo_keywords', [
            u'TODO'.encode(u'utf-8'), u'|'.encode(u'utf-8'),
            u'DONE'.encode(u'utf-8')
        ])

        settings.set(u'org_todo_prompt_position', u'botright')

        vim.command(
            u'au orgmode BufReadCmd org:todo/* :py ORGMODE.plugins[u"Todo"].init_org_todo()'
            .encode(u'utf-8'))
Beispiel #3
0
	def register(self):
		u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		settings.set(u'org_leader', u',')
		leader = settings.get(u'org_leader', u',')

		self.keybindings.append(Keybinding(u'%sd' % leader, Plug(
			u'OrgTodoToggle',
			u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(interactive=True)<CR>')))
		self.menu + ActionEntry(u'&TODO/DONE/-', self.keybindings[-1])
		submenu = self.menu + Submenu(u'Select &keyword')

		self.keybindings.append(Keybinding(u'<S-Right>', Plug(
			u'OrgTodoForward',
			u':py ORGMODE.plugins[u"Todo"].toggle_todo_state()<CR>')))
		submenu + ActionEntry(u'&Next keyword', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<S-Left>', Plug(
			u'OrgTodoBackward',
			u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(direction=False)<CR>')))
		submenu + ActionEntry(u'&Previous keyword', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<C-S-Right>', Plug(
			u'OrgTodoSetForward',
			u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(next_set=True)<CR>')))
		submenu + ActionEntry(u'Next keyword &set', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<C-S-Left>', Plug(
			u'OrgTodoSetBackward',
			u':py ORGMODE.plugins[u"Todo"].toggle_todo_state(direction=False, next_set=True)<CR>')))
		submenu + ActionEntry(u'Previous &keyword set', self.keybindings[-1])

		settings.set(u'org_todo_keywords', [u'TODO'.encode(u'utf-8'), u'|'.encode(u'utf-8'), u'DONE'.encode(u'utf-8')])
Beispiel #4
0
    def register(self):
        u"""
		Registration of the plugin.

		Key bindings and other initialization should be done here.
		"""
        settings.set(u"org_leader", u",")
        leader = settings.get(u"org_leader", u",")

        self.keybindings.append(
            Keybinding(
                u"%ssa" % leader,
                Plug(u"OrgDateInsertTimestampActive", u':py ORGMODE.plugins[u"Date"].insert_timestamp()<CR>'),
            )
        )
        self.menu + ActionEntry(u"Timest&amp", self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                u"%ssi" % leader,
                Plug(u"OrgDateInsertTimestampInactive", u':py ORGMODE.plugins[u"Date"].insert_timestamp(False)<CR>'),
            )
        )
        self.menu + ActionEntry(u"Timestamp (&inactive)", self.keybindings[-1])

        submenu = self.menu + Submenu(u"Change &Date")
        submenu + ActionEntry(u"Day &Earlier", u"<C-x>", u"<C-x>")
        submenu + ActionEntry(u"Day &Later", u"<C-a>", u"<C-a>")
Beispiel #5
0
    def register(self):
        u"""
		Registration of the plugin.

		Key bindings and other initialization should be done here.
		"""
        settings.set(u'org_leader', u',')
        leader = settings.get(u'org_leader', u',')

        self.keybindings.append(
            Keybinding(
                u'%ssa' % leader,
                Plug(u'OrgDateInsertTimestampActive',
                     u':py ORGMODE.plugins[u"Date"].insert_timestamp()<CR>')))
        self.menu + ActionEntry(u'Timest&amp', self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                u'%ssi' % leader,
                Plug(
                    u'OrgDateInsertTimestampInactive',
                    u':py ORGMODE.plugins[u"Date"].insert_timestamp(False)<CR>'
                )))
        self.menu + ActionEntry(u'Timestamp (&inactive)', self.keybindings[-1])

        submenu = self.menu + Submenu(u'Change &Date')
        submenu + ActionEntry(u'Day &Earlier', u'<C-x>', u'<C-x>')
        submenu + ActionEntry(u'Day &Later', u'<C-a>', u'<C-a>')
Beispiel #6
0
    def register(self):
        """
		Registration of plugin. Key bindings and other initialization should be done.
		"""
        settings.set('org_leader', ',')
        leader = settings.get('org_leader', ',')

        self.keybindings.append(
            Keybinding(
                '%sd' % leader,
                Plug(
                    'OrgToggleTodoToggle',
                    ':silent! py ORGMODE.plugins["Todo"].toggle_todo_state()<CR>'
                )))
        self.menu + ActionEntry('&TODO/DONE/-', self.keybindings[-1])
        submenu = self.menu + Submenu('Select &keyword')
        self.keybindings.append(
            Keybinding(
                '<S-Right>',
                Plug(
                    'OrgToggleTodoForward',
                    ':silent! py ORGMODE.plugins["Todo"].toggle_todo_state()<CR>'
                )))
        submenu + ActionEntry('&Next keyword', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                '<S-Left>',
                Plug(
                    'OrgToggleTodoBackward',
                    ':silent! py ORGMODE.plugins["Todo"].toggle_todo_state(False)<CR>'
                )))
        submenu + ActionEntry('&Previous keyword', self.keybindings[-1])

        settings.set('org_todo_keywords', ['TODO', '|', 'DONE'])
Beispiel #7
0
	def register(self):
		u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		# an Action menu entry which binds "keybinding" to action ":action"
		settings.set(u'org_tag_column', vim.eval(u'&textwidth'))
		settings.set(u'org_tag_completion_ignorecase', int(vim.eval(u'&ignorecase')))

		cmd = Command(
			u'OrgSetTags',
			u'%s ORGMODE.plugins[u"TagsProperties"].set_tags()' % VIM_PY_CALL)
		self.commands.append(cmd)
		keybinding = Keybinding(
			u'<localleader>st',
			Plug(u'OrgSetTags', cmd))
		self.keybindings.append(keybinding)
		self.menu + ActionEntry(u'Set &Tags', keybinding)

		cmd = Command(
			u'OrgFindTags',
			u'%s ORGMODE.plugins[u"TagsProperties"].find_tags()' % VIM_PY_CALL)
		self.commands.append(cmd)
		keybinding = Keybinding(
			u'<localleader>ft',
			Plug(u'OrgFindTags', cmd))
		self.keybindings.append(keybinding)
		self.menu + ActionEntry(u'&Find Tags', keybinding)

		cmd = Command(
			u'OrgTagsRealign',
			u"%s ORGMODE.plugins[u'TagsProperties'].realign_all_tags()" % VIM_PY_CALL)
		self.commands.append(cmd)

		# workaround to align tags when user is leaving insert mode
		vim.command(u_encode(u"""function Org_complete_tags(ArgLead, CmdLine, CursorPos)
python << EOF
ORGMODE.plugins[u'TagsProperties'].complete_tags()
EOF
if exists('b:org_complete_tags')
	let tmp = b:org_complete_tags
	unlet b:org_complete_tags
	return tmp
else
	return []
endif
endfunction"""))

		vim.command(u_encode(u"""
function Org_realign_tags_on_insert_leave()
	if !exists('b:org_complete_tag_on_insertleave_au')
		:au orgmode InsertLeave <buffer> %s ORGMODE.plugins[u'TagsProperties'].realign_tags()
		let b:org_complete_tag_on_insertleave_au = 1
	endif
endfunction""" % VIM_PY_CALL))

		# this is for all org files opened after this file
		vim.command(u_encode(u"au orgmode FileType org call Org_realign_tags_on_insert_leave()"))
		# this is for the current file
		vim.command(u_encode(u"call Org_realign_tags_on_insert_leave()"))
Beispiel #8
0
	def toggle_todo_state(
		cls, direction=Direction.FORWARD, interactive=False, next_set=False):
		u""" Toggle state of TODO item

		:returns: The changed heading
		"""
		d = ORGMODE.get_document(allow_dirty=True)

		# get heading
		heading = d.find_current_heading()
		if not heading:
			vim.eval(u'feedkeys("^", "n")')
			return

		todo_states = d.get_todo_states(strip_access_key=False)
		# get todo states
		if not todo_states:
			echom(u'No todo keywords configured.')
			return

		current_state = heading.todo

		# get new state interactively
		if interactive:
			# determine position of the interactive prompt
			prompt_pos = settings.get(u'org_todo_prompt_position', u'botright')
			if prompt_pos not in [u'botright', u'topleft']:
				prompt_pos = u'botright'

			# pass todo states to new window
			ORGTODOSTATES[d.bufnr] = todo_states
			settings.set(
				u'org_current_state_%d' % d.bufnr,
				current_state if current_state is not None else u'', overwrite=True)
			todo_buffer_exists = bool(int(vim.eval(u_encode(
				u'bufexists("org:todo/%d")' % (d.bufnr, )))))
			if todo_buffer_exists:
				# if the buffer already exists, reuse it
				vim.command(u_encode(
					u'%s sbuffer org:todo/%d' % (prompt_pos, d.bufnr, )))
			else:
				# create a new window
				vim.command(u_encode(
					u'keepalt %s %dsplit org:todo/%d' % (prompt_pos, len(todo_states), d.bufnr)))
		else:
			new_state = Todo._get_next_state(
				current_state, todo_states, direction=direction,
				next_set=next_set)

			cls.set_todo_state(new_state)

		# plug
		plug = u'OrgTodoForward'
		if direction == Direction.BACKWARD:
			plug = u'OrgTodoBackward'

		return plug
Beispiel #9
0
	def toggle_todo_state(cls, direction=Direction.FORWARD, interactive=False, next_set=False):
		u""" Toggle state of TODO item

		:returns: The changed heading
		"""
		d = ORGMODE.get_document(allow_dirty=True)

		# get heading
		heading = d.find_current_heading()
		if not heading:
			vim.eval(u'feedkeys("^", "n")')
			return

		todo_states = d.get_todo_states(strip_access_key=False)
		# get todo states
		if not todo_states:
			echom(u'No todo keywords configured.')
			return

		current_state = heading.todo

		# get new state interactively
		if interactive:
			# determine position of the interactive prompt
			prompt_pos = settings.get(u'org_todo_prompt_position', u'botright')
			if prompt_pos not in [u'botright', u'topleft']:
				prompt_pos = u'botright'

			# pass todo states to new window
			ORGTODOSTATES[d.bufnr] = todo_states
			settings.set(
				u'org_current_state_%d' % d.bufnr,
				current_state if current_state is not None else u'', overwrite=True)
			todo_buffer_exists = bool(int(vim.eval((
				u'bufexists("org:todo/%d")' % (d.bufnr, )).encode(u'utf-8'))))
			if todo_buffer_exists:
				# if the buffer already exists, reuse it
				vim.command((
					u'%s sbuffer org:todo/%d' % (prompt_pos, d.bufnr, )).encode(u'utf-8'))
			else:
				# create a new window
				vim.command((
					u'keepalt %s %dsplit org:todo/%d' % (prompt_pos, len(todo_states), d.bufnr)).encode(u'utf-8'))
		else:
			new_state = Todo._get_next_state(
				current_state, todo_states, direction=direction,
				interactive=interactive, next_set=next_set)
			cls.set_todo_state(new_state)

		# plug
		plug = u'OrgTodoForward'
		if direction == Direction.BACKWARD:
			plug = u'OrgTodoBackward'

		return plug
Beispiel #10
0
	def register(self):
		u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		# register plug

		self.keybindings.append(Keybinding(u'<Tab>', Plug(u'OrgToggleFolding', u':py ORGMODE.plugins[u"ShowHide"].toggle_folding()<CR>')))
		self.menu + ActionEntry(u'&Cycle Visibility', self.keybindings[-1])

		settings.set(u'org_leader', u',')
		leader = settings.get(u'org_leader', u',')

		self.keybindings.append(Keybinding(u'%s,' % (leader, ), u':exe ":set fdl=". (&fdl - 1)<CR>', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'%s.' % (leader, ), u':exe ":set fdl=". (&fdl + 1)<CR>', mode=MODE_NORMAL))
		for i in xrange(0, 10):
			self.keybindings.append(Keybinding(u'%s%d' % (leader, i), u'zM:set fdl=%d<CR>' % i, mode=MODE_NORMAL))
Beispiel #11
0
	def register(self):
		"""
		Registration of the plugin.

		Key bindings and other initialization should be done here.
		"""
		settings.set('org_leader', ',')
		leader = settings.get('org_leader', ',')

		self.keybindings.append(Keybinding('%stn' % leader,
				Plug('OrgDateInsertTimestampActive',
				':py ORGMODE.plugins["Date"].insert_timestamp()<CR>')))
		self.menu + ActionEntry('Timestamp', self.keybindings[-1])

		self.keybindings.append(Keybinding('%sti' % leader,
				Plug('OrgDateInsertTimestampInactive',
					':py ORGMODE.plugins["Date"].insert_timestamp(False)<CR>')))
		self.menu + ActionEntry('Timestamp (inactive)', self.keybindings[-1])
Beispiel #12
0
	def register(self):
		u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		self.keybindings.append(Keybinding(u'<localleader>ct', Plug(
			u'OrgTodoToggleNonInteractive',
			u'%s ORGMODE.plugins[u"Todo"].toggle_todo_state(interactive=False)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'&TODO/DONE/-', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<localleader>d', Plug(
			u'OrgTodoToggleInteractive',
			u'%s ORGMODE.plugins[u"Todo"].toggle_todo_state(interactive=True)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'&TODO/DONE/- (interactiv)', self.keybindings[-1])

		# add submenu
		submenu = self.menu + Submenu(u'Select &keyword')

		self.keybindings.append(Keybinding(u'<S-Right>', Plug(
			u'OrgTodoForward',
			u'%s ORGMODE.plugins[u"Todo"].toggle_todo_state()<CR>' % VIM_PY_CALL)))
		submenu + ActionEntry(u'&Next keyword', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<S-Left>', Plug(
			u'OrgTodoBackward',
			u'%s ORGMODE.plugins[u"Todo"].toggle_todo_state(direction=2)<CR>' % VIM_PY_CALL)))
		submenu + ActionEntry(u'&Previous keyword', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<C-S-Right>', Plug(
			u'OrgTodoSetForward',
			u'%s ORGMODE.plugins[u"Todo"].toggle_todo_state(next_set=True)<CR>' % VIM_PY_CALL)))
		submenu + ActionEntry(u'Next keyword &set', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'<C-S-Left>', Plug(
			u'OrgTodoSetBackward',
			u'%s ORGMODE.plugins[u"Todo"].toggle_todo_state(direction=2, next_set=True)<CR>' % VIM_PY_CALL)))
		submenu + ActionEntry(u'Previous &keyword set', self.keybindings[-1])

		settings.set(u'org_todo_keywords', [u_encode(u'TODO'), u_encode(u'|'), u_encode(u'DONE')])

		settings.set(u'org_todo_prompt_position', u'botright')

		vim.command(u_encode(u'au orgmode BufReadCmd org:todo/* %s ORGMODE.plugins[u"Todo"].init_org_todo()' % VIM_PY_CALL))
Beispiel #13
0
	def register(self):
		u"""
		Registration and keybindings.
		"""

		# leader settings
		settings.set(u'org_leader', u',')
		leader = settings.get(u'org_leader', u',')

		# to PDF
		self.keybindings.append(Keybinding(u'%sep' % leader,
				Plug(u'OrgExportToPDF',
				u':py ORGMODE.plugins[u"Export"].topdf()<CR>')))
		self.menu + ActionEntry(u'To PDF (via Emacs)', self.keybindings[-1])

		# to HTML
		self.keybindings.append(Keybinding(u'%seh' % leader,
				Plug(u'OrgExportToHTML',
				u':py ORGMODE.plugins[u"Export"].tohtml()<CR>')))
		self.menu + ActionEntry(u'To HTML (via Emacs)', self.keybindings[-1])
Beispiel #14
0
    def register(self):
        u"""
		Registration and keybindings.
		"""

        # path to emacs executable
        settings.set(u'org_export_emacs', u'/usr/bin/emacs')

        # verbose output for export
        settings.set(u'org_export_verbose', 0)

        # allow the user to define an initialization script
        settings.set(u'org_export_init_script', u'')

        # to PDF
        self.commands.append(Command(u'OrgExportToPDF', \
          u':py ORGMODE.plugins[u"Export"].topdf()<CR>'))
        self.keybindings.append(
            Keybinding(u'<localleader>ep',
                       Plug(u'OrgExportToPDF', self.commands[-1])))
        self.menu + ActionEntry(u'To PDF (via Emacs)', self.keybindings[-1])

        # to HTML
        self.commands.append(Command(u'OrgExportToHTML', \
          u':py ORGMODE.plugins[u"Export"].tohtml()<CR>'))
        self.keybindings.append(
            Keybinding(u'<localleader>eh',
                       Plug(u'OrgExportToHTML', self.commands[-1])))
        self.menu + ActionEntry(u'To HTML (via Emacs)', self.keybindings[-1])
Beispiel #15
0
	def register(self):
		u"""Registration and keybindings."""

		# path to emacs executable
		settings.set(u'org_export_emacs', u'/usr/bin/emacs')
		# verbose output for export
		settings.set(u'org_export_verbose', 0)
		# allow the user to define an initialization script
		settings.set(u'org_export_init_script', u'')

		# to PDF
		add_cmd_mapping_menu(
			self,
			name=u'OrgExportToPDF',
			function=u':py ORGMODE.plugins[u"Export"].topdf()<CR>',
			key_mapping=u'<localleader>ep',
			menu_desrc=u'To PDF (via Emacs)'
		)
		# to latex
		add_cmd_mapping_menu(
			self,
			name=u'OrgExportToLaTeX',
			function=u':py ORGMODE.plugins[u"Export"].tolatex()<CR>',
			key_mapping=u'<localleader>el',
			menu_desrc=u'To LaTeX (via Emacs)'
		)
		# to HTML
		add_cmd_mapping_menu(
			self,
			name=u'OrgExportToHTML',
			function=u':py ORGMODE.plugins[u"Export"].tohtml()<CR>',
			key_mapping=u'<localleader>eh',
			menu_desrc=u'To HTML (via Emacs)'
		)
Beispiel #16
0
	def register(self):
		u"""
		Registration and keybindings.
		"""

		# path to emacs executable
		settings.set(u'org_export_emacs', u'/usr/bin/emacs')

		# verbose output for export
		settings.set(u'org_export_verbose', 0)

		# allow the user to define an initialization script
		settings.set(u'org_export_init_script', u'')

		# to PDF
		self.commands.append(Command(u'OrgExportToPDF', \
				u':py ORGMODE.plugins[u"Export"].topdf()<CR>'))
		self.keybindings.append(Keybinding(u'<localleader>ep',
				Plug(u'OrgExportToPDF', self.commands[-1])))
		self.menu + ActionEntry(u'To PDF (via Emacs)', self.keybindings[-1])

		# to HTML
		self.commands.append(Command(u'OrgExportToHTML', \
				u':py ORGMODE.plugins[u"Export"].tohtml()<CR>'))
		self.keybindings.append(Keybinding(u'<localleader>eh',
				Plug(u'OrgExportToHTML', self.commands[-1])))
		self.menu + ActionEntry(u'To HTML (via Emacs)', self.keybindings[-1])
Beispiel #17
0
	def register(self):
		"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		settings.set('org_leader', ',')
		leader = settings.get('org_leader', ',')

		self.keybindings.append(Keybinding('%sd' % leader, Plug(
			'OrgToggleTodoToggle',
			':silent! py ORGMODE.plugins["Todo"].toggle_todo_state()<CR>')))
		self.menu + ActionEntry('&TODO/DONE/-', self.keybindings[-1])
		submenu = self.menu + Submenu('Select &keyword')
		self.keybindings.append(Keybinding('<S-Right>', Plug(
			'OrgToggleTodoForward',
			':silent! py ORGMODE.plugins["Todo"].toggle_todo_state()<CR>')))
		submenu + ActionEntry('&Next keyword', self.keybindings[-1])
		self.keybindings.append(Keybinding('<S-Left>', Plug(
			'OrgToggleTodoBackward',
			':silent! py ORGMODE.plugins["Todo"].toggle_todo_state(False)<CR>')))
		submenu + ActionEntry('&Previous keyword', self.keybindings[-1])

		settings.set('org_todo_keywords', ['TODO', '|', 'DONE'])
Beispiel #18
0
	def register(self):
		u"""
		Registration of the plugin.

		Key bindings and other initialization should be done here.
		"""
		settings.set(u'org_leader', u',')
		leader = settings.get(u'org_leader', u',')

		self.keybindings.append(Keybinding(u'%ssa' % leader,
				Plug(u'OrgDateInsertTimestampActive',
				u':py ORGMODE.plugins[u"Date"].insert_timestamp()<CR>')))
		self.menu + ActionEntry(u'Timest&amp', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'%ssi' % leader,
				Plug(u'OrgDateInsertTimestampInactive',
					u':py ORGMODE.plugins[u"Date"].insert_timestamp(False)<CR>')))
		self.menu + ActionEntry(u'Timestamp (&inactive)', self.keybindings[-1])

		submenu = self.menu + Submenu(u'Change &Date')
		submenu + ActionEntry(u'Day &Earlier', u'<C-x>', u'<C-x>')
		submenu + ActionEntry(u'Day &Later', u'<C-a>', u'<C-a>')
Beispiel #19
0
    def register(self):
        """
		Registration of the plugin.

		Key bindings and other initialization should be done here.
		"""
        settings.set('org_leader', ',')
        leader = settings.get('org_leader', ',')

        self.keybindings.append(
            Keybinding(
                '%stn' % leader,
                Plug('OrgDateInsertTimestampActive',
                     ':py ORGMODE.plugins["Date"].insert_timestamp()<CR>')))
        self.menu + ActionEntry('Timestamp', self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                '%sti' % leader,
                Plug(
                    'OrgDateInsertTimestampInactive',
                    ':py ORGMODE.plugins["Date"].insert_timestamp(False)<CR>'))
        )
        self.menu + ActionEntry('Timestamp (inactive)', self.keybindings[-1])
Beispiel #20
0
    def register(self):
        u"""
		Registration and keybindings.
		"""

        # leader settings
        settings.set(u'org_leader', u',')
        leader = settings.get(u'org_leader', u',')

        # to PDF
        self.keybindings.append(
            Keybinding(
                u'%sep' % leader,
                Plug(u'OrgExportToPDF',
                     u':py ORGMODE.plugins[u"Export"].topdf()<CR>')))
        self.menu + ActionEntry(u'To PDF (via Emacs)', self.keybindings[-1])

        # to HTML
        self.keybindings.append(
            Keybinding(
                u'%seh' % leader,
                Plug(u'OrgExportToHTML',
                     u':py ORGMODE.plugins[u"Export"].tohtml()<CR>')))
        self.menu + ActionEntry(u'To HTML (via Emacs)', self.keybindings[-1])
Beispiel #21
0
	def register(self):
		u"""
		Registration of the plugin.

		Key bindings and other initialization should be done here.
		"""
		settings.set(u'org_leader', u',')
		leader = settings.get(u'org_leader', u',')

		self.keybindings.append(Keybinding(u'%scat' % leader,
				Plug(u'OrgAgendaTodo',
				u':py ORGMODE.plugins[u"Agenda"].list_all_todos()<CR>')))
		self.menu + ActionEntry(u'Agenda for all TODOs', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'%scaa' % leader,
				Plug(u'OrgAgendaWeek',
				u':py ORGMODE.plugins[u"Agenda"].list_next_week()<CR>')))
		self.menu + ActionEntry(u'Agenda for the week', self.keybindings[-1])

		self.keybindings.append(Keybinding(u'%scaL' % leader,
				Plug(u'OrgAgendaTimeline',
				u':py ORGMODE.plugins[u"Agenda"].list_timeline()<CR>')))
		self.menu + ActionEntry(u'Timeline for this buffer',
				self.keybindings[-1])
Beispiel #22
0
    def register(self):
        """
		Registration of plugin. Key bindings and other initialization should be done.
		"""
        # an Action menu entry which binds "keybinding" to action ":action"
        settings.set('org_tags_column', '77')

        settings.set('org_tags_completion_ignorecase', '0')

        settings.set('org_leader', ',')
        leader = settings.get('org_leader', ',')

        self.keybindings.append(
            Keybinding(
                '%st' % leader,
                Plug('OrgSetTags',
                     ':py ORGMODE.plugins["TagsProperties"].set_tags()<CR>')))
        self.menu + ActionEntry('Set &Tags', self.keybindings[-1])

        self.commands.append(
            Command(
                'OrgTagsRealign',
                ":py ORGMODE.plugins['TagsProperties'].realign_all_tags()"))

        # workaround to align tags when user is leaving insert mode
        vim.command("""function Org_complete_tags(ArgLead, CmdLine, CursorPos)
python << EOF
ORGMODE.plugins['TagsProperties'].complete_tags()
EOF
if exists('b:org_complete_tags')
	let tmp = b:org_complete_tags
	unlet b:org_complete_tags
	return tmp
else
	return []
endif
endfunction""")

        # this is for all org files opened after this file
        vim.command(
            "au FileType org :au InsertLeave <buffer> :py ORGMODE.plugins['TagsProperties'].realign_tags()"
        )

        # this is for the current file
        vim.command(
            "au InsertLeave <buffer> :py ORGMODE.plugins['TagsProperties'].realign_tags()"
        )
Beispiel #23
0
	def register(self):
		"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
		# an Action menu entry which binds "keybinding" to action ":action"
		settings.set('org_tags_column', '77')

		settings.set('org_tags_completion_ignorecase', '0')

		settings.set('org_leader', ',')
		leader = settings.get('org_leader', ',')

		self.keybindings.append(Keybinding('%st' % leader, Plug('OrgSetTags', ':py ORGMODE.plugins["TagsProperties"].set_tags()<CR>')))
		self.menu + ActionEntry('Set &Tags', self.keybindings[-1])

		self.commands.append(Command('OrgTagsRealign', ":py ORGMODE.plugins['TagsProperties'].realign_all_tags()"))

		# workaround to align tags when user is leaving insert mode
		vim.command("""function Org_complete_tags(ArgLead, CmdLine, CursorPos)
python << EOF
ORGMODE.plugins['TagsProperties'].complete_tags()
EOF
if exists('b:org_complete_tags')
	let tmp = b:org_complete_tags
	unlet b:org_complete_tags
	return tmp
else
	return []
endif
endfunction""")

		# this is for all org files opened after this file
		vim.command("au FileType org :au InsertLeave <buffer> :py ORGMODE.plugins['TagsProperties'].realign_tags()")

		# this is for the current file
		vim.command("au InsertLeave <buffer> :py ORGMODE.plugins['TagsProperties'].realign_tags()")
Beispiel #24
0
    def register(self):
        u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
        settings.set(u"org_improve_split_heading", u"1")

        self.keybindings.append(
            Keybinding(
                u"<C-S-CR>",
                Plug(
                    u"OrgNewHeadingAboveNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=False)<CR>',
                ),
            )
        )
        self.menu + ActionEntry(u"New Heading &above", self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u"<S-CR>",
                Plug(
                    u"OrgNewHeadingBelowNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=True)<CR>',
                ),
            )
        )
        self.menu + ActionEntry(u"New Heading &below", self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u"<C-CR>",
                Plug(
                    u"OrgNewHeadingBelowAfterChildrenNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=True, end_of_last_child=True)<CR>',
                ),
            )
        )
        self.menu + ActionEntry(u"New Heading below, after &children", self.keybindings[-1])

        self.keybindings.append(
            Keybinding(
                u"<C-S-CR>",
                Plug(
                    u"OrgNewHeadingAboveInsert",
                    u'<C-o>:<C-u>silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=False, insert_mode=True)<CR>',
                    mode=MODE_INSERT,
                ),
            )
        )
        self.keybindings.append(
            Keybinding(
                u"<S-CR>",
                Plug(
                    u"OrgNewHeadingBelowInsert",
                    u'<C-o>:<C-u>silent! py ORGMODE.plugins[u"EditStructure"].new_heading(insert_mode=True)<CR>',
                    mode=MODE_INSERT,
                ),
            )
        )
        self.keybindings.append(
            Keybinding(
                u"<C-CR>",
                Plug(
                    u"OrgNewHeadingBelowAfterChildrenInsert",
                    u'<C-o>:<C-u>silent! py ORGMODE.plugins[u"EditStructure"].new_heading(insert_mode=True, end_of_last_child=True)<CR>',
                    mode=MODE_INSERT,
                ),
            )
        )

        self.menu + Separator()

        self.keybindings.append(
            Keybinding(
                u"m{",
                Plug(
                    u"OrgMoveHeadingUpward",
                    u':py ORGMODE.plugins[u"EditStructure"].move_heading_upward(including_children=False)<CR>',
                ),
            )
        )
        self.keybindings.append(
            Keybinding(
                u"m[[",
                Plug(u"OrgMoveSubtreeUpward", u':py ORGMODE.plugins[u"EditStructure"].move_heading_upward()<CR>'),
            )
        )
        self.menu + ActionEntry(u"Move Subtree &Up", self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u"m}",
                Plug(
                    u"OrgMoveHeadingDownward",
                    u':py ORGMODE.plugins[u"EditStructure"].move_heading_downward(including_children=False)<CR>',
                ),
            )
        )
        self.keybindings.append(
            Keybinding(
                u"m]]",
                Plug(u"OrgMoveSubtreeDownward", u':py ORGMODE.plugins[u"EditStructure"].move_heading_downward()<CR>'),
            )
        )
        self.menu + ActionEntry(u"Move Subtree &Down", self.keybindings[-1])

        self.menu + Separator()

        self.menu + ActionEntry(u"&Copy Heading", u"yah", u"yah")
        self.menu + ActionEntry(u"C&ut Heading", u"dah", u"dah")

        self.menu + Separator()

        self.menu + ActionEntry(u"&Copy Subtree", u"yar", u"yar")
        self.menu + ActionEntry(u"C&ut Subtree", u"dar", u"dar")
        self.menu + ActionEntry(u"&Paste Subtree", u"p", u"p")

        self.menu + Separator()

        self.keybindings.append(
            Keybinding(
                u"<ah",
                Plug(
                    u"OrgPromoteHeadingNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False)<CR>',
                ),
            )
        )
        self.menu + ActionEntry(u"&Promote Heading", self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u"<<",
                Plug(
                    u"OrgPromoteOnHeadingNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True)<CR>',
                ),
            )
        )
        self.keybindings.append(Keybinding(u"<{", u"<Plug>OrgPromoteHeadingNormal", mode=MODE_NORMAL))
        self.keybindings.append(Keybinding(u"<ih", u"<Plug>OrgPromoteHeadingNormal", mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u"<ar",
                Plug(
                    u"OrgPromoteSubtreeNormal", u':silent! py ORGMODE.plugins[u"EditStructure"].promote_heading()<CR>'
                ),
            )
        )
        self.menu + ActionEntry(u"&Promote Subtree", self.keybindings[-1])
        self.keybindings.append(Keybinding(u"<[[", u"<Plug>OrgPromoteSubtreeNormal", mode=MODE_NORMAL))
        self.keybindings.append(Keybinding(u"<ir", u"<Plug>OrgPromoteSubtreeNormal", mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u">ah",
                Plug(
                    u"OrgDemoteHeadingNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False)<CR>',
                ),
            )
        )
        self.menu + ActionEntry(u"&Demote Heading", self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u">>",
                Plug(
                    u"OrgDemoteOnHeadingNormal",
                    u':silent! py ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True)<CR>',
                ),
            )
        )
        self.keybindings.append(Keybinding(u">}", u">Plug>OrgDemoteHeadingNormal", mode=MODE_NORMAL))
        self.keybindings.append(Keybinding(u">ih", u">Plug>OrgDemoteHeadingNormal", mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u">ar",
                Plug(u"OrgDemoteSubtreeNormal", u':silent! py ORGMODE.plugins[u"EditStructure"].demote_heading()<CR>'),
            )
        )
        self.menu + ActionEntry(u"&Demote Subtree", self.keybindings[-1])
        self.keybindings.append(Keybinding(u">]]", u"<Plug>OrgDemoteSubtreeNormal", mode=MODE_NORMAL))
        self.keybindings.append(Keybinding(u">ir", u"<Plug>OrgDemoteSubtreeNormal", mode=MODE_NORMAL))

        # other keybindings
        self.keybindings.append(
            Keybinding(
                u"<C-d>",
                Plug(
                    u"OrgPromoteOnHeadingInsert",
                    u'<C-o>:silent! py ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>',
                    mode=MODE_INSERT,
                ),
            )
        )
        self.keybindings.append(
            Keybinding(
                u"<C-t>",
                Plug(
                    u"OrgDemoteOnHeadingInsert",
                    u'<C-o>:silent! py ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>',
                    mode=MODE_INSERT,
                ),
            )
        )
Beispiel #25
0
    def register(self):
        u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
        # EditStructure related default settings
        settings.set(u'org_improve_split_heading', u'1')
        # EditStructure related keybindings
        self.keybindings.append(
            Keybinding(
                u'<C-S-CR>',
                Plug(
                    u'OrgNewHeadingAboveNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=False)<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'New Heading &above', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(u'<localleader>hN',
                       u'<Plug>OrgNewHeadingAboveNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'<localleader><CR>',
                       u'<Plug>OrgNewHeadingAboveNormal',
                       mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u'<S-CR>',
                Plug(
                    u'OrgNewHeadingBelowNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=True)<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'New Heading &below', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(u'<localleader>hh',
                       u'<Plug>OrgNewHeadingBelowNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'<leader><CR>',
                       u'<Plug>OrgNewHeadingBelowNormal',
                       mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u'<C-CR>',
                Plug(
                    u'OrgNewHeadingBelowAfterChildrenNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=True, end_of_last_child=True)<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'New Heading below, after &children',
                                self.keybindings[-1])
        self.keybindings.append(
            Keybinding(u'<localleader>hn',
                       u'<Plug>OrgNewHeadingBelowAfterChildrenNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'<CR>',
                       u'<Plug>OrgNewHeadingBelowAfterChildrenNormal',
                       mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u'<C-S-CR>',
                Plug(
                    u'OrgNewHeadingAboveInsert',
                    u'<C-o>:<C-u>silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=False, insert_mode=True)<CR>'
                    % VIM_PY_CALL,
                    mode=MODE_INSERT)))
        self.keybindings.append(
            Keybinding(
                u'<S-CR>',
                Plug(
                    u'OrgNewHeadingBelowInsert',
                    u'<C-o>:<C-u>silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=True, insert_mode=True)<CR>'
                    % VIM_PY_CALL,
                    mode=MODE_INSERT)))
        self.keybindings.append(
            Keybinding(
                u'<C-CR>',
                Plug(
                    u'OrgNewHeadingBelowAfterChildrenInsert',
                    u'<C-o>:<C-u>silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(insert_mode=True, end_of_last_child=True)<CR>'
                    % VIM_PY_CALL,
                    mode=MODE_INSERT)))

        self.menu + Separator()

        self.keybindings.append(
            Keybinding(
                u'm{',
                Plug(
                    u'OrgMoveHeadingUpward',
                    u'%s ORGMODE.plugins[u"EditStructure"].move_heading_upward(including_children=False)<CR>'
                    % VIM_PY_CALL)))
        self.keybindings.append(
            Keybinding(
                u'm[[',
                Plug(
                    u'OrgMoveSubtreeUpward',
                    u'%s ORGMODE.plugins[u"EditStructure"].move_heading_upward()<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'Move Subtree &Up', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u'm}',
                Plug(
                    u'OrgMoveHeadingDownward',
                    u'%s ORGMODE.plugins[u"EditStructure"].move_heading_downward(including_children=False)<CR>'
                    % VIM_PY_CALL)))
        self.keybindings.append(
            Keybinding(
                u'm]]',
                Plug(
                    u'OrgMoveSubtreeDownward',
                    u'%s ORGMODE.plugins[u"EditStructure"].move_heading_downward()<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'Move Subtree &Down', self.keybindings[-1])

        self.menu + Separator()

        self.menu + ActionEntry(u'&Copy Heading', u'yah', u'yah')
        self.menu + ActionEntry(u'C&ut Heading', u'dah', u'dah')

        self.menu + Separator()

        self.menu + ActionEntry(u'&Copy Subtree', u'yar', u'yar')
        self.menu + ActionEntry(u'C&ut Subtree', u'dar', u'dar')
        self.menu + ActionEntry(u'&Paste Subtree', u'p', u'p')

        self.menu + Separator()

        self.keybindings.append(
            Keybinding(
                u'<ah',
                Plug(
                    u'OrgPromoteHeadingNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False)<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'&Promote Heading', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u'<<',
                Plug(
                    u'OrgPromoteOnHeadingNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True)<CR>'
                    % VIM_PY_CALL)))
        self.keybindings.append(
            Keybinding(u'<{',
                       u'<Plug>OrgPromoteHeadingNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'<ih',
                       u'<Plug>OrgPromoteHeadingNormal',
                       mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u'<ar',
                Plug(
                    u'OrgPromoteSubtreeNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading()<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'&Promote Subtree', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(u'<[[',
                       u'<Plug>OrgPromoteSubtreeNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'<ir',
                       u'<Plug>OrgPromoteSubtreeNormal',
                       mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u'>ah',
                Plug(
                    u'OrgDemoteHeadingNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False)<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'&Demote Heading', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(
                u'>>',
                Plug(
                    u'OrgDemoteOnHeadingNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True)<CR>'
                    % VIM_PY_CALL)))
        self.keybindings.append(
            Keybinding(u'>}',
                       u'<Plug>OrgDemoteHeadingNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'>ih',
                       u'<Plug>OrgDemoteHeadingNormal',
                       mode=MODE_NORMAL))

        self.keybindings.append(
            Keybinding(
                u'>ar',
                Plug(
                    u'OrgDemoteSubtreeNormal',
                    u':silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading()<CR>'
                    % VIM_PY_CALL)))
        self.menu + ActionEntry(u'&Demote Subtree', self.keybindings[-1])
        self.keybindings.append(
            Keybinding(u'>]]',
                       u'<Plug>OrgDemoteSubtreeNormal',
                       mode=MODE_NORMAL))
        self.keybindings.append(
            Keybinding(u'>ir',
                       u'<Plug>OrgDemoteSubtreeNormal',
                       mode=MODE_NORMAL))

        # other keybindings
        self.keybindings.append(
            Keybinding(
                u'<C-d>',
                Plug(
                    u'OrgPromoteOnHeadingInsert',
                    u'<C-o>:silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>'
                    % VIM_PY_CALL,
                    mode=MODE_INSERT)))
        self.keybindings.append(
            Keybinding(
                u'<C-t>',
                Plug(
                    u'OrgDemoteOnHeadingInsert',
                    u'<C-o>:silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>'
                    % VIM_PY_CALL,
                    mode=MODE_INSERT)))
Beispiel #26
0
    def register(self):
        u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
        # an Action menu entry which binds "keybinding" to action ":action"
        settings.set(u'org_tag_column', vim.eval(u'&textwidth'))
        settings.set(u'org_tag_completion_ignorecase',
                     int(vim.eval(u'&ignorecase')))

        cmd = Command(
            u'OrgSetTags',
            u'%s ORGMODE.plugins[u"TagsProperties"].set_tags()' % VIM_PY_CALL)
        self.commands.append(cmd)
        keybinding = Keybinding(u'<localleader>st', Plug(u'OrgSetTags', cmd))
        self.keybindings.append(keybinding)
        self.menu + ActionEntry(u'Set &Tags', keybinding)

        cmd = Command(
            u'OrgFindTags',
            u'%s ORGMODE.plugins[u"TagsProperties"].find_tags()' % VIM_PY_CALL)
        self.commands.append(cmd)
        keybinding = Keybinding(u'<localleader>ft', Plug(u'OrgFindTags', cmd))
        self.keybindings.append(keybinding)
        self.menu + ActionEntry(u'&Find Tags', keybinding)

        cmd = Command(
            u'OrgTagsRealign',
            u"%s ORGMODE.plugins[u'TagsProperties'].realign_all_tags()" %
            VIM_PY_CALL)
        self.commands.append(cmd)

        # workaround to align tags when user is leaving insert mode
        vim.command(
            u_encode(
                u"""function Org_complete_tags(ArgLead, CmdLine, CursorPos)
python << EOF
ORGMODE.plugins[u'TagsProperties'].complete_tags()
EOF
if exists('b:org_complete_tags')
	let tmp = b:org_complete_tags
	unlet b:org_complete_tags
	return tmp
else
	return []
endif
endfunction"""))

        vim.command(
            u_encode(u"""
function Org_realign_tags_on_insert_leave()
	if !exists('b:org_complete_tag_on_insertleave_au')
		:au orgmode InsertLeave <buffer> %s ORGMODE.plugins[u'TagsProperties'].realign_tags()
		let b:org_complete_tag_on_insertleave_au = 1
	endif
endfunction""" % VIM_PY_CALL))

        # this is for all org files opened after this file
        vim.command(
            u_encode(
                u"au orgmode FileType org call Org_realign_tags_on_insert_leave()"
            ))
        # this is for the current file
        vim.command(u_encode(u"call Org_realign_tags_on_insert_leave()"))
	def register(self):
		u"""
		Registration of plugin. Key bindings and other initialization should be done.
		"""
# EditStructure related default settings
		settings.set(u'org_improve_split_heading', u'1')
# EditStructure related keybindings
		self.keybindings.append(Keybinding(u'<C-S-CR>',
									 Plug(u'OrgNewHeadingAboveNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=False)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'New Heading &above', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'<localleader>hN', u'<Plug>OrgNewHeadingAboveNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'<localleader><CR>', u'<Plug>OrgNewHeadingAboveNormal', mode=MODE_NORMAL))

		self.keybindings.append(Keybinding(u'<S-CR>',
									 Plug(u'OrgNewHeadingBelowNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=True)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'New Heading &below', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'<localleader>hh', u'<Plug>OrgNewHeadingBelowNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'<leader><CR>', u'<Plug>OrgNewHeadingBelowNormal', mode=MODE_NORMAL))

		self.keybindings.append(Keybinding(u'<C-CR>', Plug(u'OrgNewHeadingBelowAfterChildrenNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=True, end_of_last_child=True)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'New Heading below, after &children', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'<localleader>hn', u'<Plug>OrgNewHeadingBelowAfterChildrenNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'<SPACE>', u'<Plug>OrgNewHeadingBelowAfterChildrenNormal', mode=MODE_NORMAL))

		self.keybindings.append(Keybinding(u'<C-S-CR>', Plug(u'OrgNewHeadingAboveInsert', u'<C-o>:<C-u>silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=False, insert_mode=True)<CR>' % VIM_PY_CALL, mode=MODE_INSERT)))
		self.keybindings.append(Keybinding(u'<S-CR>', Plug(u'OrgNewHeadingBelowInsert', u'<C-o>:<C-u>silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(below=True, insert_mode=True)<CR>' % VIM_PY_CALL, mode=MODE_INSERT)))
		self.keybindings.append(Keybinding(u'<C-CR>', Plug(u'OrgNewHeadingBelowAfterChildrenInsert', u'<C-o>:<C-u>silent! %s ORGMODE.plugins[u"EditStructure"].new_heading(insert_mode=True, end_of_last_child=True)<CR>' % VIM_PY_CALL, mode=MODE_INSERT)))

		self.menu + Separator()

		self.keybindings.append(Keybinding(u'm{', Plug(u'OrgMoveHeadingUpward',
												 u'%s ORGMODE.plugins[u"EditStructure"].move_heading_upward(including_children=False)<CR>' % VIM_PY_CALL)))
		self.keybindings.append(Keybinding(u'm[[',
									 Plug(u'OrgMoveSubtreeUpward', u'%s ORGMODE.plugins[u"EditStructure"].move_heading_upward()<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'Move Subtree &Up', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'm}',
									 Plug(u'OrgMoveHeadingDownward', u'%s ORGMODE.plugins[u"EditStructure"].move_heading_downward(including_children=False)<CR>' % VIM_PY_CALL)))
		self.keybindings.append(Keybinding(u'm]]',
									 Plug(u'OrgMoveSubtreeDownward', u'%s ORGMODE.plugins[u"EditStructure"].move_heading_downward()<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'Move Subtree &Down', self.keybindings[-1])

		self.menu + Separator()

		self.menu + ActionEntry(u'&Copy Heading', u'yah', u'yah')
		self.menu + ActionEntry(u'C&ut Heading', u'dah', u'dah')

		self.menu + Separator()

		self.menu + ActionEntry(u'&Copy Subtree', u'yar', u'yar')
		self.menu + ActionEntry(u'C&ut Subtree', u'dar', u'dar')
		self.menu + ActionEntry(u'&Paste Subtree', u'p', u'p')

		self.menu + Separator()

		self.keybindings.append(Keybinding(u'<ah', Plug(u'OrgPromoteHeadingNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'&Promote Heading', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'<<', Plug(u'OrgPromoteOnHeadingNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True)<CR>' % VIM_PY_CALL)))
		self.keybindings.append(Keybinding(u'<{', u'<Plug>OrgPromoteHeadingNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'<ih', u'<Plug>OrgPromoteHeadingNormal', mode=MODE_NORMAL))

		self.keybindings.append(Keybinding(u'<ar', Plug(u'OrgPromoteSubtreeNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading()<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'&Promote Subtree', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'[[', u'<Plug>OrgPromoteSubtreeNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'<ir', u'<Plug>OrgPromoteSubtreeNormal', mode=MODE_NORMAL))

		self.keybindings.append(Keybinding(u'>ah', Plug(u'OrgDemoteHeadingNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False)<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'&Demote Heading', self.keybindings[-1])
		self.keybindings.append(Keybinding(u'>>', Plug(u'OrgDemoteOnHeadingNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True)<CR>' % VIM_PY_CALL)))
		self.keybindings.append(Keybinding(u'>}', u'<Plug>OrgDemoteHeadingNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'>ih', u'<Plug>OrgDemoteHeadingNormal', mode=MODE_NORMAL))

		self.keybindings.append(Keybinding(u'>ar', Plug(u'OrgDemoteSubtreeNormal', u':silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading()<CR>' % VIM_PY_CALL)))
		self.menu + ActionEntry(u'&Demote Subtree', self.keybindings[-1])
		self.keybindings.append(Keybinding(u']]', u'<Plug>OrgDemoteSubtreeNormal', mode=MODE_NORMAL))
		self.keybindings.append(Keybinding(u'>ir', u'<Plug>OrgDemoteSubtreeNormal', mode=MODE_NORMAL))

		# other keybindings
		self.keybindings.append(Keybinding(u'<C-d>', Plug(u'OrgPromoteOnHeadingInsert', u'<C-o>:silent! %s ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>' % VIM_PY_CALL, mode=MODE_INSERT)))
		self.keybindings.append(Keybinding(u'<C-t>', Plug(u'OrgDemoteOnHeadingInsert', u'<C-o>:silent! %s ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>' % VIM_PY_CALL, mode=MODE_INSERT)))