-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManager.Chars.lua
More file actions
168 lines (127 loc) · 5.44 KB
/
Copy pathManager.Chars.lua
File metadata and controls
168 lines (127 loc) · 5.44 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
--[[ Editor macros ]]--
----------------------------------------
--[[ description:
-- Macros for editor area.
-- Макросы для области редактора.
--]]
----------------------------------------
--[[ uses:
nil.
-- group: Macros/Manager.
--]]
--------------------------------------------------------------------------------
local tonumber, tostring = tonumber, tostring
----------------------------------------
local far = far
local F = far.Flags
----------------------------------------
--local context = context
local strings = require 'context.utils.useStrings'
----------------------------------------
--[[
local debugs = require "context.utils.useDebugs"
local logShow = debugs.Show
--]]
--------------------------------------------------------------------------------
--local unit = {}
----------------------------------------
--local guids = {}
--unit.guids = guids
local Macro = Macro or function () end
---------------------------------------- Conditions
local function Exist ()
return true
end
local function IsDlgEdit ()
return not Area.Dialog or
Area.Dialog and Dlg.ItemType == F.DI_EDIT
end -- IsDlgEdit
local function ExistSpec ()
if Area.Menu then return end
return IsDlgEdit() and Exist()
end -- ExistSpec
---------------------------------------- Characters
-- [[
do
local BSh = "BackSlash"
local Characters = {
-- Alt + <a> -- Alt+Shift + <a> -- Ctrl+Alt+Shift + <a>
-- Latin key-characters: -- Latin number-characters:
["["] = "LAlt[", ["{"] = "LAltShift[",
["]"] = "LAlt]", ["}"] = "LAltShift]",
[","] = "LAlt,", ["<"] = "LAltShift,", ["#"] = "LCtrlLAltShift,",
["."] = "LAlt.", [">"] = "LAltShift.", ["^"] = "LCtrlLAltShift.",
[";"] = "LAlt;", [":"] = "LAltShift;", ["$"] = "LCtrlLAltShift;",
["'"] = "LAlt'", ['"'] = "LAltShift'", ["@"] = "LCtrlLAltShift'",
["`"] = "LAlt`", ["~"] = "LAltShift`", --["ʼ"] = "LCtrlLAltShift'",
["/"] = "LAlt/", ["?"] = "LAltShift/", ["&"] = "LCtrlLAltShift/",
["\\"] = "LAlt"..BSh, ["|"] = "LAltShift"..BSh, ["‾"] = "LCtrlLAltShift"..BSh,
["´"] = "RAlt`", ["∽"] = "RAltShift`", --["ʼ"] = "LCtrlLAltShift'",
["ʻ"] = "RAlt;", ["ʽ"] = "RAltShift;", --[""] = "RCtrlRAltShift;",
["ʼ"] = "RAlt'", ['ˮ'] = "RAltShift'", --[""] = "RCtrlRAltShift'",
["°"] = "RAlt"..BSh, ["¦"] = "RAltShift"..BSh, ["‖"] = "RCtrlRAltShift"..BSh,
-- Special characters:
--[""]
[" "] = "LCtrlShiftSpace",
["…"] = "LCtrlLAlt/",
["°"] = "|", --["°"] = "Shift"..BSh,
["́"] = "LCtrl"..BSh,
["§"] = "LCtrlShift"..BSh,
["―"] = "LCtrlLAlt"..BSh,
["≤"] = "LCtrlLAlt,",
["≥"] = "LCtrlLAlt.",
-- Index characters:
--₁₂₃₄₅₆₇₈₉₀₊₋₌₍₎
--¹²³⁴⁵⁶⁷⁸⁹⁰⁺⁻⁼⁽⁾
["₁"] = "RCtrlLAlt1", ["¹"] = "RCtrlLAltShift1",
["₂"] = "RCtrlLAlt2", ["²"] = "RCtrlLAltShift2",
["₃"] = "RCtrlLAlt3", ["³"] = "RCtrlLAltShift3",
["₄"] = "RCtrlLAlt4", ["⁴"] = "RCtrlLAltShift4",
["₅"] = "RCtrlLAlt5", ["⁵"] = "RCtrlLAltShift5",
["₆"] = "RCtrlLAlt6", ["⁶"] = "RCtrlLAltShift6",
["₇"] = "RCtrlLAlt7", ["⁷"] = "RCtrlLAltShift7",
["₈"] = "RCtrlLAlt8", ["⁸"] = "RCtrlLAltShift8",
["₉"] = "RCtrlLAlt9", ["⁹"] = "RCtrlLAltShift9",
["₀"] = "RCtrlLAlt0", ["⁰"] = "RCtrlLAltShift0",
["₋"] = "RCtrlLAlt-", ["⁻"] = "RCtrlLAltShift-",
["₊"] = "RCtrlLAlt=", ["⁺"] = "RCtrlLAltShift=",
["₌"] = "RCtrlLAlt"..BSh,
["⁼"] = "RCtrlLAltShift"..BSh,
-- Math/Lang characters with Numpad:
-- Num+ — Add -- -- Num* — Multiply --
["−"] = "ShiftAdd", ["⋅"] = "ShiftMultiply",
["±"] = "LCtrlAdd", ["×"] = "LCtrlMultiply",
["∓"] = "LCtrlShiftAdd", ["¤"] = "LCtrlShiftMultiply",
["†"] = "LCtrlLAltAdd", ["·"] = "LCtrlLAltMultiply",
["∑"] = "LAltAdd", ["∏"] = "LAltMultiply",
["∫"] = "LAltShiftAdd", ["∂"] = "LAltShiftMultiply",
-- Num- — Subtract -- -- Num/ — Divide --
[""] = "ShiftSubtract", ["÷"] = "ShiftDivide",
["—"] = "LCtrlSubtract", ["∕"] = "LCtrlDivide",
["‑"] = "LCtrlShiftSubtract", ["∞"] = "LCtrlShiftDivide",
["–"] = "LCtrlLAltSubtract", ["⁄"] = "LCtrlLAltDivide",
[" "] = "LAltSubtract", ["√"] = "LAltDivide",
["‒"] = "LAltShiftSubtract", ["∛"] = "LAltShiftDivide",
-- Graphic characters with Numpad:
["┼"] = "LCtrlLAltShiftAdd", ["●"] = "LCtrlLAltShiftMultiply",
["─"] = "LCtrlLAltShiftSubtract", ["│"] = "LCtrlLAltShiftDivide",
} --- Characters
----------------------------------------
local u8byte = strings.u8byte -- UTF-8 char to codepoint
local ucp2s = strings.ucp2s -- Char codepoint to string
local DescFmt = "Char: '%s' | U-%s"
for k, v in pairs(Characters) do
if k ~= "" then
Macro {
area = "Editor Dialog",
key = v,
flags = "",
description = DescFmt:format(k, ucp2s(u8byte(k), true)),
condition = ExistSpec,
action = function () print(k) end, ---
} ---
end
end -- for
end -- do
--]]
--------------------------------------------------------------------------------