forked from editor-bootstrap/vim-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editors.py
59 lines (42 loc) · 1.12 KB
/
editors.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
54
55
56
57
58
59
# -*- coding: utf-8 -*-
import os
class BaseEditor(object):
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
class VimEditor(BaseEditor):
@property
def basedir(self):
return "~/.{0.name}".format(self)
@property
def rc(self):
return "~/.{0.name}rc".format(self)
@property
def localrc(self):
return "{0.rc}.local".format(self)
@property
def localbundlerc(self):
return "{0.rc}.local.bundles".format(self)
class NvimEditor(BaseEditor):
@property
def basedir(self):
return "~/.config/{0.name}".format(self)
@property
def rc(self):
return os.path.join(self.basedir, "init.vim")
@property
def localrc(self):
return os.path.join(self.basedir, "local_init.vim")
@property
def localbundlerc(self):
return os.path.join(self.basedir, "local_bundles.vim")
EDITORS = {
'nvim': NvimEditor,
'vim': VimEditor
}
def get_editor(name):
try:
return EDITORS[name](name)
except KeyError:
raise ValueError("Unknown editor '{}'".format(name))