-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdecipher.txt
293 lines (222 loc) · 11.8 KB
/
decipher.txt
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
*decipher.nvim* {Encode and decode text}
==============================================================================
█▀▀▄ █▀▀▀ █▀▀▀ █ █▀▀▄ █ █ █▀▀▀ █▀▀▄ █▄ █ █ █ █ █▄ ▄█
█ █ ██ █ █ █▄▄█ ████ ██ █▄▄█ █▀▄█ █ █ █ █ ▀ █
█▄▄▀ █▄▄▄ █▄▄▄ █ █ █ █ █▄▄▄ █ █ ▄ █ ▀█ ▀▄▄▀ █ █ █
Version 1.0.2
A plugin that provides ways to encode and decode text using various codecs
like base64.
==============================================================================
decipher *decipher*
`decipher.nvim`
Setup ....................................................... |decipher.setup|
Types ....................................................... |decipher.types|
Functions ............................................... |decipher.functions|
Mappings ................................................. |decipher.mappings|
Motions ................................................... |decipher.motions|
Highlights ............................................. |decipher.highlights|
Codecs ..................................................... |decipher.codecs|
FAQ ........................................................... |decipher.faq|
License ................................................... |decipher.license|
==============================================================================
Setup *decipher-setup*
Warning: A bit library is needed which requires that either neovim has been
compiled with luajit or you are using v0.9.0+ which provides a bit library.
Setup decipher using `decipher.setup` unless you are content with the defaults.
The options below are the default values.
>lua
require("decipher").setup({
active_codecs = "all", -- Set all codecs as active and useable
float = { -- Floating window options
padding = 0, -- Zero padding (does not apply to title if any)
border = { -- Floating window border
{ "╭", "FloatBorder" },
{ "─", "FloatBorder" },
{ "╮", "FloatBorder" },
{ "│", "FloatBorder" },
{ "╯", "FloatBorder" },
{ "─", "FloatBorder" },
{ "╰", "FloatBorder" },
{ "│", "FloatBorder" },
},
mappings = {
close = "q", -- Key to press to close the floating window
apply = "a", -- Key to press to apply the encoding/decoding
jsonpp = "J", -- Key to prettily format contents as json if possbile
help = "?", -- Toggle help
},
title = true, -- Display a title with the codec name
title_pos = "left", -- Position of the title
autoclose = true, -- Autoclose floating window if insert
-- mode is activated or the cursor is moved
enter = false, -- Automatically enter the floating window if
-- opened
options = {}, -- Options to apply to the floating window contents
},
})
==============================================================================
Types *decipher.types*
<
*decipher.Config*
Fields:
{active_codecs} `"all" | (string | decipher.Codecs)[]`
A list of the codecs that should be active or "all" for all
codecs. This only affects the codecs you can choose from when
selecting a codec via vim.ui.select.
{float} `decipher.WindowConfig`
*decipher.WindowConfig*
Fields:
{padding} `number`
Padding around the contents in the floating window preview.
{border} (`string | string[]`)[]
Border around the floating window preview.
{mappings} `table`
Mappings for the floating window preview. Used as the left-hand
side in a normal map defintion.
{close} `string`
Key to press to close the floating window.
{apply} `string`
Key to press to apply the encoded/decoded contents of the text
in the floating window preview.
{jsonpp} `string`
Key to prettily format the contents in the floating window
preview as json if possbile. Note that since lua table keys do
not have any deterministic order, the prettified contents
might have a different order of keys than the original
contents.
{help} `string`
Toggle help.
{title} `boolean`
Whether or not to show a title in the floating window preview or
not. This option requires at least nvim 0.9.
{title_pos} "left" | "center" | "right"
Same as the config argument for |nvim_open_win|. Either "left",
"center", or "right". Not used if the title is disabled.
{autoclose} `boolean`
Autoclose the floating window preview if insert mode is entered or
the cursor is moved.
{enter} `boolean`
Automatically enter the floating window preview when opened.
{options} `table<string, any>`
Buffer-local options to set for the floating window preview.
*decipher.Options*
Fields:
{preview} `(boolean)` If true, show a preview of the encoding/decoding
instead of encoding/decoding in place.
*decipher.CodecArg*
{string | decipher.Codecs}
General type for functions that accept codecs as arguments. Either a
string (e.g. "base64") or or a an enum (e.g. decipher.codec.base64).
==============================================================================
Functions *decipher.functions*
Any functions not listed here that may be accessed via the decipher module are
not considered public and are subject to change.
setup({config}) *decipher.setup*
Setup global configuration for decipher. See |decipher.setup|.
Parameters:
• {config} (decipher.Config) Setup configuration table
version() *decipher.version*
Returns the current version as a string.
supported_codecs() *decipher.supported_codecs*
Returns a list of currently supported codecs.
active_codecs() *decipher.active_codecs*
Returns a list of currently active codecs as per |active_codecs| in
`decipher.Config`.
encode({codec_name}, {value}) *decipher.encode*
Encode a value using a codec.
Parameters:
• {codec_name} (`decipher.CodecArg`) Setup configuration table
• {value} (`string`) Value to encode
decode({codec_name}, {value}) *decipher.decode*
Decode a value using a codec.
encode_selection({codec_name}, {options}) *decipher.encode_selection*
Encode a visual selection using a codec.
Parameters:
• {codec_name} (`decipher.CodecArg`) Codec to use for encoding
• {options} (`decipher.Options`) Options to use
decode_selection({codec_name}, {options}) *decipher.decode_selection*
Decode a visual selection using a codec.
Parameters:
• {codec_name} (`decipher.CodecArg`) Codec to use for decoding
• {options} (`decipher.Options`) Options to use
encode_motion({codec_name}, {options}) *decipher.encode_motion*
Encode using a motion and a codec.
Parameters:
• {codec_name} (`decipher.CodecArg`) Codec to use for encoding
• {options} (`decipher.Options`) Options to use
decode_motion({codec_name}, {options}) *decipher.decode_motion*
Decode using a motion and a codec.
Parameters:
• {codec_name} (`decipher.CodecArg`) Codec to use for decoding
• {options} (`decipher.Options`) Options to use
encode_selection_prompt({options}) *decipher.encode_selection_prompt*
Encode a visual selection using a codec. Prompts with a list of the active
codecs via vim.ui.select.
Parameters:
• {options} (`decipher.Options`) Options to use
decode_selection_prompt({options}) *decipher.decode_selection_prompt*
Decode a visual selection using a codec. Prompts with a list of the active
codecs via vim.ui.select.
Parameters:
• {options} (`decipher.Options`) Options to use
encode_motion_prompt({options}) *decipher.encode_motion_prompt*
Encode using a motion. Prompts with a list of the active codecs via
vim.ui.select.
Parameters:
• {options} (`decipher.Options`) Options to use
decode_motion_prompt({options}) *decipher.decode_motion_prompt*
Decode using a motion. Prompts with a list of the active codecs via
vim.ui.select.
Parameters:
• {options} (`decipher.Options`) Options to use
==============================================================================
Mappings *decipher.mappings*
No mappings are provided by default except for those for floating windows. See
the `float.mappings` option in *decipher.WindowConfig*. Mappings can easily be
set up via the lua api.
>lua
local decipher = require("decipher")
vim.keymap.set(
"n",
"<leader>de",
function()
decipher.encode_selection("crockford")
end,
{ noremap = true, silent = true }
)
==============================================================================
Motions *decipher.motions*
Decipher can encode and decode across a motion. The following lua code sets up
decipher to decode a text object using base64 using a floating window preview.
>lua
local decipher = require("decipher")
vim.keymap.set(
"n",
"<leader>d",
function()
decipher.decode_motion("base64", { preview = true })
end,
{ noremap = true, silent = true }
)
==============================================================================
Highlights *decipher.highlights*
*DecipherFloatTitle*
Highlight group for the title of the floating window preview. Defaults to
*Title*.
==============================================================================
Codecs *decipher.codecs*
Currently supported codecs:
* base32
* zbase32: Variant of base32 with a different alphabet.
* crockford: Variant of base32 with a different alphabet.
* base64
* base64-url: Combination of base64 and url codecs.
* base64-url-safe: Base64-variant that is safe to include in urls.
* url
==============================================================================
FAQ *decipher.faq*
Nothing yet.
==============================================================================
License *decipher.license*
BSD 3-Clause License. Copyright © 2020 MisanthropicBit
vim:tw=78:ts=8:ft=help:norl: