forked from jceb/vim-orgmode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPluginExample.py
53 lines (40 loc) · 1.24 KB
/
PluginExample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
from orgmode import echo, echom, echoe, ORGMODE, apply_count, repeat
from orgmode.menu import Submenu, Separator, ActionEntry
from orgmode.keybinding import Keybinding, Plug, Command
import vim
class Example(object):
u"""
Example plugin.
TODO: Extend this doc!
"""
def __init__(self):
u""" Initialize plugin """
object.__init__(self)
# menu entries this plugin should create
self.menu = ORGMODE.orgmenu + Submenu(u'Example')
# key bindings for this plugin
# key bindings are also registered through the menu so only additional
# bindings should be put in this variable
self.keybindings = []
# commands for this plugin
self.commands = []
@classmethod
def action(cls):
u"""
Some kind of action.
:returns: TODO
"""
pass
def register(self):
u"""
Registration of the plugin.
Key bindings and other initialization should be done here.
"""
# an Action menu entry which binds "keybinding" to action ":action"
self.commands.append(Command(u'OrgActionCommand',
u':py ORGMODE.plugins["Example"].action()'))
self.keybindings.append(Keybinding(u'keybinding',
Plug(u'OrgAction', self.commands[-1])))
self.menu + ActionEntry(u'&Action', self.keybindings[-1])
# vim: set noexpandtab: