1local info = {
2 version = 1.002,
3 comment = "presets for textadept for context/metafun",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files",
7}
8
9local lexer = require("scite-context-lexer")
10local context = lexer.context
11
12if context then
13
14 function context.synchronize()
15 local buffer = buffer
16 local property = lexer.property
17 local property_int = lexer.property_int
18
19 buffer:set_fold_margin_colour (true, property_int["color.light"])
20 buffer:set_fold_margin_hi_colour (true, property_int["color.white"])
21 buffer:set_sel_fore (false, property_int["color.dark"])
22 buffer:set_sel_back (true, property_int["color.selection"])
23
24 local MARK_BOOKMARK = textadept.bookmarks.MARK_BOOKMARK
25 local MARK_WARNING = textadept.run.MARK_WARNING
26 local MARK_ERROR = textadept.run.MARK_ERROR
27
28
29 buffer.marker_back[MARK_BOOKMARK] = property_int["color.blue"]
30
31 buffer.marker_back[MARK_WARNING] = property_int["color.orange"]
32
33 buffer.marker_back[MARK_ERROR] = property_int["color.red"]
34 for i = 25, 31 do
35 buffer.marker_fore[i] = property_int["color.white"]
36 buffer.marker_back[i] = property_int["color.grey"]
37 buffer.marker_back_selected[i] = property_int["color.dark"]
38 end
39
40 local INDIC_BRACEMATCH = textadept.editing .INDIC_BRACEMATCH
41 local INDIC_HIGHLIGHT = textadept.editing .INDIC_HIGHLIGHT
42 local INDIC_PLACEHOLDER = textadept.snippets.INDIC_PLACEHOLDER
43 local INDIC_FIND = ui.find.INDIC_FIND
44
45 buffer.indic_fore [INDIC_FIND] = property_int["color.gray"]
46 buffer.indic_alpha[INDIC_FIND] = 255
47 buffer.indic_fore [INDIC_BRACEMATCH] = property_int["color.orange"]
48 buffer.indic_style[INDIC_BRACEMATCH] = buffer.INDIC_BOX
49 buffer.indic_fore [INDIC_HIGHLIGHT] = property_int["color.gray"]
50 buffer.indic_alpha[INDIC_HIGHLIGHT] = 255
51 buffer.indic_fore [INDIC_PLACEHOLDER] = property_int["color.gray"]
52
53
54
55
56 buffer.edge_colour = property_int["color.grey"]
57
58 buffer.tab_width = 4
59 buffer.use_tabs = false
60 buffer.indent = 4
61 buffer.tab_indents = true
62 buffer.back_space_un_indents = true
63 buffer.indentation_guides = not CURSES and buffer.IV_LOOKBOTH or buffer.IV_NONE
64 buffer.wrap_length = 80
65
66 buffer.sel_eol_filled = true
67
68 buffer.multiple_selection = true
69 buffer.additional_selection_typing = true
70
71
72 buffer.rectangular_selection_modifier = buffer.MOD_ALT
73 buffer.mouse_selection_rectangular_switch = true
74
75
76
77
78
79
80
81
82
83
84 buffer.caret_line_visible = false
85 buffer.caret_line_visible_always = false
86
87
88 buffer.caret_width = 10
89 buffer.caret_sticky = buffer.CARETSTICKY_ON
90 buffer.caret_fore = property_int["color.black"]
91 buffer.caret_line_back = property_int["color.light"]
92
93
94 buffer.view_ws = buffer.WS_INVISIBLE
95 buffer.view_eol = false
96
97 buffer.annotation_visible = buffer.ANNOTATION_BOXED
98
99 local NUMBER_MARGIN = 0
100 local MARKER_MARGIN = 1
101 local FOLD_MARGIN = 2
102
103 buffer.margin_type_n [NUMBER_MARGIN] = buffer.MARGIN_NUMBER
104 buffer.margin_width_n[NUMBER_MARGIN] = (CURSES and 0 or 6) + 4 * buffer:text_width(buffer.STYLE_LINENUMBER,'9')
105 buffer.margin_width_n[MARKER_MARGIN] = CURSES and 1 or 18
106 buffer.margin_width_n[FOLD_MARGIN] = CURSES and 1 or 18
107
108 buffer.margin_mask_n[FOLD_MARGIN] = buffer.MASK_FOLDERS
109
110 buffer:marker_define(buffer.MARKNUM_FOLDEROPEN, buffer.MARK_BOXMINUS)
111 buffer:marker_define(buffer.MARKNUM_FOLDER, buffer.MARK_BOXPLUS)
112 buffer:marker_define(buffer.MARKNUM_FOLDERSUB, buffer.MARK_VLINE)
113 buffer:marker_define(buffer.MARKNUM_FOLDERTAIL, buffer.MARK_LCORNER)
114 buffer:marker_define(buffer.MARKNUM_FOLDEREND, buffer.MARK_BOXPLUSCONNECTED)
115 buffer:marker_define(buffer.MARKNUM_FOLDEROPENMID, buffer.MARK_BOXMINUSCONNECTED)
116 buffer:marker_define(buffer.MARKNUM_FOLDERMIDTAIL, buffer.MARK_TCORNER)
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131 buffer.wrap_mode = buffer.WRAP_NONE
132
133 buffer.margin_back_n[NUMBER_MARGIN] = property_int["color.linenumber"]
134
135 buffer.property = {
136
137 }
138
139 buffer.property_int = {
140
141 }
142
143
144
145
146
147
148 end
149
150 context.synchronize()
151
152end
153 |