@enjoys/context-engine 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,48 +2,191 @@
2
2
  "language": "zsh",
3
3
  "completions": [
4
4
  {
5
- "label": "shebang",
5
+ "label": "#!/bin/zsh",
6
6
  "kind": 15,
7
7
  "detail": "Zsh shebang",
8
8
  "documentation": {
9
9
  "value": "Zsh script shebang line."
10
10
  },
11
- "insertText": "#!/usr/bin/env zsh",
11
+ "insertText": "#!/usr/bin/env zsh\n\n${1:# Script content}",
12
12
  "insertTextRules": 4,
13
13
  "sortText": "00_shebang"
14
14
  },
15
15
  {
16
- "label": "alias",
16
+ "label": "strict mode",
17
17
  "kind": 15,
18
- "detail": "Alias",
18
+ "detail": "Strict script mode",
19
19
  "documentation": {
20
- "value": "Define a command alias."
20
+ "value": "Enable strict mode for safer scripts."
21
21
  },
22
- "insertText": "alias ${1:name}='${2:command}'",
22
+ "insertText": "#!/usr/bin/env zsh\nset -euo pipefail\n\n${1:# Script content}",
23
23
  "insertTextRules": 4,
24
- "sortText": "00_alias"
24
+ "sortText": "00_strict"
25
25
  },
26
26
  {
27
- "label": "function",
27
+ "label": "script template",
28
28
  "kind": 15,
29
- "detail": "Function",
29
+ "detail": "Full script template",
30
+ "documentation": {
31
+ "value": "Production zsh script template with error handling."
32
+ },
33
+ "insertText": "#!/usr/bin/env zsh\nset -euo pipefail\n\n# Colors\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nYELLOW='\\033[1;33m'\nNC='\\033[0m'\n\nlog_info() { echo \"${GREEN}[INFO]${NC} \\$1\" }\nlog_warn() { echo \"${YELLOW}[WARN]${NC} \\$1\" >&2 }\nlog_error() { echo \"${RED}[ERROR]${NC} \\$1\" >&2 }\n\ncleanup() {\n # Cleanup code here\n ${2:true}\n}\ntrap cleanup EXIT\n\n${1:# Main logic}",
34
+ "insertTextRules": 4,
35
+ "sortText": "00_template"
36
+ },
37
+ {
38
+ "label": "variable assignment",
39
+ "kind": 6,
40
+ "detail": "Variable",
30
41
  "documentation": {
31
- "value": "Define a shell function."
42
+ "value": "Assign a value to a variable."
32
43
  },
33
- "insertText": "${1:fname}() {\n ${2:# body}\n}",
44
+ "insertText": "${1:name}=${2:value}",
34
45
  "insertTextRules": 4,
35
- "sortText": "00_func"
46
+ "sortText": "01_var"
47
+ },
48
+ {
49
+ "label": "local variable",
50
+ "kind": 6,
51
+ "detail": "Local variable",
52
+ "documentation": {
53
+ "value": "Declare a local variable in a function."
54
+ },
55
+ "insertText": "local ${1:name}=${2:value}",
56
+ "insertTextRules": 4,
57
+ "sortText": "01_local"
58
+ },
59
+ {
60
+ "label": "typeset",
61
+ "kind": 6,
62
+ "detail": "Typed variable",
63
+ "documentation": {
64
+ "value": "Declare a variable with type attributes."
65
+ },
66
+ "insertText": "typeset -${1:i} ${2:name}=${3:value}",
67
+ "insertTextRules": 4,
68
+ "sortText": "01_typeset"
69
+ },
70
+ {
71
+ "label": "integer variable",
72
+ "kind": 6,
73
+ "detail": "Integer",
74
+ "documentation": {
75
+ "value": "Declare an integer variable."
76
+ },
77
+ "insertText": "integer ${1:count}=${2:0}",
78
+ "insertTextRules": 4,
79
+ "sortText": "01_integer"
80
+ },
81
+ {
82
+ "label": "float variable",
83
+ "kind": 6,
84
+ "detail": "Float",
85
+ "documentation": {
86
+ "value": "Declare a float variable."
87
+ },
88
+ "insertText": "float ${1:value}=${2:0.0}",
89
+ "insertTextRules": 4,
90
+ "sortText": "01_float"
91
+ },
92
+ {
93
+ "label": "readonly variable",
94
+ "kind": 6,
95
+ "detail": "Readonly",
96
+ "documentation": {
97
+ "value": "Declare a readonly constant."
98
+ },
99
+ "insertText": "readonly ${1:NAME}=${2:value}",
100
+ "insertTextRules": 4,
101
+ "sortText": "01_readonly"
36
102
  },
37
103
  {
38
104
  "label": "export",
39
- "kind": 15,
105
+ "kind": 14,
40
106
  "detail": "Export variable",
41
107
  "documentation": {
42
- "value": "Export an environment variable."
108
+ "value": "Export a variable to child processes."
43
109
  },
44
110
  "insertText": "export ${1:NAME}=\"${2:value}\"",
45
111
  "insertTextRules": 4,
46
- "sortText": "00_export"
112
+ "sortText": "01_export"
113
+ },
114
+ {
115
+ "label": "array declaration",
116
+ "kind": 6,
117
+ "detail": "Array",
118
+ "documentation": {
119
+ "value": "Declare an array. Zsh arrays are 1-indexed."
120
+ },
121
+ "insertText": "${1:arr}=(${2:item1 item2 item3})",
122
+ "insertTextRules": 4,
123
+ "sortText": "02_array"
124
+ },
125
+ {
126
+ "label": "associative array",
127
+ "kind": 6,
128
+ "detail": "Associative array",
129
+ "documentation": {
130
+ "value": "Declare an associative array (hash)."
131
+ },
132
+ "insertText": "typeset -A ${1:hash}\n${1:hash}=(\n ${2:key1} ${3:value1}\n ${4:key2} ${5:value2}\n)",
133
+ "insertTextRules": 4,
134
+ "sortText": "02_assoc"
135
+ },
136
+ {
137
+ "label": "array iteration",
138
+ "kind": 15,
139
+ "detail": "Iterate array",
140
+ "documentation": {
141
+ "value": "Loop over array elements."
142
+ },
143
+ "insertText": "for ${1:item} in \"\\${${2:arr}[@]}\"; do\n ${3:echo \"\\$${1:item}\"}\ndone",
144
+ "insertTextRules": 4,
145
+ "sortText": "02_array_iter"
146
+ },
147
+ {
148
+ "label": "array operations",
149
+ "kind": 15,
150
+ "detail": "Array ops",
151
+ "documentation": {
152
+ "value": "Common array operations."
153
+ },
154
+ "insertText": "# Length: \\${#${1:arr}[@]}\n# Append: ${1:arr}+=(${2:new_item})\n# Slice: \\${${1:arr}[2,4]}\n# Remove: ${1:arr}[\\${${1:arr}[(i)${3:item}]}]=()\n# Search: \\${${1:arr}[(i)${3:item}]}",
155
+ "insertTextRules": 4,
156
+ "sortText": "02_array_ops"
157
+ },
158
+ {
159
+ "label": "function",
160
+ "kind": 3,
161
+ "detail": "Function",
162
+ "documentation": {
163
+ "value": "Define a function."
164
+ },
165
+ "insertText": "${1:func_name}() {\n ${2:local arg1=\\$1}\n ${3:# function body}\n}",
166
+ "insertTextRules": 4,
167
+ "sortText": "03_func"
168
+ },
169
+ {
170
+ "label": "function with args",
171
+ "kind": 3,
172
+ "detail": "Function with arguments",
173
+ "documentation": {
174
+ "value": "Function with named parameters."
175
+ },
176
+ "insertText": "${1:func_name}() {\n local ${2:name}=\\$1\n local ${3:value}=\\$2\n local -a ${4:rest}=(\\${@:3})\n\n ${5:# function body}\n}",
177
+ "insertTextRules": 4,
178
+ "sortText": "03_func_args"
179
+ },
180
+ {
181
+ "label": "anonymous function",
182
+ "kind": 3,
183
+ "detail": "Anonymous function",
184
+ "documentation": {
185
+ "value": "Zsh anonymous function (executed immediately)."
186
+ },
187
+ "insertText": "() {\n local ${1:var}=${2:value}\n ${3:# executed immediately}\n}",
188
+ "insertTextRules": 4,
189
+ "sortText": "03_anon"
47
190
  },
48
191
  {
49
192
  "label": "if",
@@ -52,9 +195,9 @@
52
195
  "documentation": {
53
196
  "value": "Conditional if statement."
54
197
  },
55
- "insertText": "if [[ ${1:condition} ]]; then\n ${2:# commands}\nfi",
198
+ "insertText": "if [[ ${1:condition} ]]; then\n ${2:# body}\nfi",
56
199
  "insertTextRules": 4,
57
- "sortText": "01_if"
200
+ "sortText": "04_if"
58
201
  },
59
202
  {
60
203
  "label": "if-else",
@@ -63,31 +206,86 @@
63
206
  "documentation": {
64
207
  "value": "If-else conditional."
65
208
  },
66
- "insertText": "if [[ ${1:condition} ]]; then\n ${2:# true branch}\nelse\n ${3:# false branch}\nfi",
209
+ "insertText": "if [[ ${1:condition} ]]; then\n ${2:# true}\nelse\n ${3:# false}\nfi",
67
210
  "insertTextRules": 4,
68
- "sortText": "01_ifelse"
211
+ "sortText": "04_ifelse"
212
+ },
213
+ {
214
+ "label": "if-elif-else",
215
+ "kind": 15,
216
+ "detail": "If-elif-else",
217
+ "documentation": {
218
+ "value": "Multi-branch conditional."
219
+ },
220
+ "insertText": "if [[ ${1:condition1} ]]; then\n ${2:# branch 1}\nelif [[ ${3:condition2} ]]; then\n ${4:# branch 2}\nelse\n ${5:# default}\nfi",
221
+ "insertTextRules": 4,
222
+ "sortText": "04_ifelif"
69
223
  },
70
224
  {
71
225
  "label": "for loop",
72
226
  "kind": 15,
73
227
  "detail": "For loop",
74
228
  "documentation": {
75
- "value": "Iterate over a list of items."
229
+ "value": "Iterate over items."
230
+ },
231
+ "insertText": "for ${1:item} in ${2:items}; do\n ${3:echo \"\\$${1:item}\"}\ndone",
232
+ "insertTextRules": 4,
233
+ "sortText": "04_for"
234
+ },
235
+ {
236
+ "label": "for loop C-style",
237
+ "kind": 15,
238
+ "detail": "C-style for",
239
+ "documentation": {
240
+ "value": "C-style for loop."
241
+ },
242
+ "insertText": "for ((${1:i}=0; ${1:i}<${2:10}; ${1:i}++)); do\n ${3:echo \"\\$${1:i}\"}\ndone",
243
+ "insertTextRules": 4,
244
+ "sortText": "04_forC"
245
+ },
246
+ {
247
+ "label": "for loop range",
248
+ "kind": 15,
249
+ "detail": "Range for loop",
250
+ "documentation": {
251
+ "value": "Loop over numeric range."
76
252
  },
77
- "insertText": "for ${1:item} in ${2:items}; do\n ${3:echo \"$item\"}\ndone",
253
+ "insertText": "for ${1:i} in {${2:1}..${3:10}}; do\n ${4:echo \"\\$${1:i}\"}\ndone",
78
254
  "insertTextRules": 4,
79
- "sortText": "01_for"
255
+ "sortText": "04_forrange"
80
256
  },
81
257
  {
82
258
  "label": "while loop",
83
259
  "kind": 15,
84
260
  "detail": "While loop",
85
261
  "documentation": {
86
- "value": "Loop while condition is true."
262
+ "value": "While loop."
87
263
  },
88
- "insertText": "while [[ ${1:condition} ]]; do\n ${2:# commands}\ndone",
264
+ "insertText": "while ${1:condition}; do\n ${2:# body}\ndone",
89
265
  "insertTextRules": 4,
90
- "sortText": "01_while"
266
+ "sortText": "04_while"
267
+ },
268
+ {
269
+ "label": "while read line",
270
+ "kind": 15,
271
+ "detail": "Read lines",
272
+ "documentation": {
273
+ "value": "Read file/stdin line by line."
274
+ },
275
+ "insertText": "while IFS= read -r ${1:line}; do\n ${2:echo \"\\$${1:line}\"}\ndone < ${3:\"\\$file\"}",
276
+ "insertTextRules": 4,
277
+ "sortText": "04_whileread"
278
+ },
279
+ {
280
+ "label": "until loop",
281
+ "kind": 15,
282
+ "detail": "Until loop",
283
+ "documentation": {
284
+ "value": "Loop until condition is true."
285
+ },
286
+ "insertText": "until ${1:condition}; do\n ${2:# body}\ndone",
287
+ "insertTextRules": 4,
288
+ "sortText": "04_until"
91
289
  },
92
290
  {
93
291
  "label": "case",
@@ -96,119 +294,680 @@
96
294
  "documentation": {
97
295
  "value": "Pattern matching case statement."
98
296
  },
99
- "insertText": "case ${1:$var} in\n ${2:pattern1})\n ${3:# commands}\n ;;\n *)\n ${4:# default}\n ;;\nesac",
297
+ "insertText": "case ${1:\\$var} in\n ${2:pattern1})\n ${3:# action}\n ;;\n ${4:pattern2})\n ${5:# action}\n ;;\n *)\n ${6:# default}\n ;;\nesac",
100
298
  "insertTextRules": 4,
101
- "sortText": "01_case"
299
+ "sortText": "04_case"
102
300
  },
103
301
  {
104
- "label": "PATH append",
302
+ "label": "select menu",
105
303
  "kind": 15,
106
- "detail": "Add to PATH",
304
+ "detail": "Select menu",
107
305
  "documentation": {
108
- "value": "Append a directory to PATH."
306
+ "value": "Interactive menu selection."
109
307
  },
110
- "insertText": "export PATH=\"${1:$HOME/.local/bin}:$PATH\"",
308
+ "insertText": "select ${1:choice} in ${2:option1 option2 option3 quit}; do\n case \\$${1:choice} in\n quit) break ;;\n *) echo \"You chose: \\$${1:choice}\" ;;\n esac\ndone",
111
309
  "insertTextRules": 4,
112
- "sortText": "02_path"
310
+ "sortText": "04_select"
113
311
  },
114
312
  {
115
- "label": "source plugin",
313
+ "label": "string length",
116
314
  "kind": 15,
117
- "detail": "Source a plugin",
315
+ "detail": "String length",
118
316
  "documentation": {
119
- "value": "Source a zsh plugin file."
317
+ "value": "Get string length."
120
318
  },
121
- "insertText": "source ${1:$ZSH/plugins/${2:git}/${2:git}.plugin.zsh}",
319
+ "insertText": "\\${#${1:var}}",
122
320
  "insertTextRules": 4,
123
- "sortText": "02_source"
321
+ "sortText": "05_strlen"
124
322
  },
125
323
  {
126
- "label": "autoload",
324
+ "label": "substring",
325
+ "kind": 15,
326
+ "detail": "Substring",
327
+ "documentation": {
328
+ "value": "Extract substring."
329
+ },
330
+ "insertText": "\\${${1:var}:${2:offset}:${3:length}}",
331
+ "insertTextRules": 4,
332
+ "sortText": "05_substr"
333
+ },
334
+ {
335
+ "label": "string replace",
336
+ "kind": 15,
337
+ "detail": "String replace",
338
+ "documentation": {
339
+ "value": "Replace pattern in string."
340
+ },
341
+ "insertText": "\\${${1:var}/${2:pattern}/${3:replacement}}",
342
+ "insertTextRules": 4,
343
+ "sortText": "05_strreplace"
344
+ },
345
+ {
346
+ "label": "string replace all",
347
+ "kind": 15,
348
+ "detail": "Replace all",
349
+ "documentation": {
350
+ "value": "Replace all occurrences."
351
+ },
352
+ "insertText": "\\${${1:var}//${2:pattern}/${3:replacement}}",
353
+ "insertTextRules": 4,
354
+ "sortText": "05_strreplaceall"
355
+ },
356
+ {
357
+ "label": "string trim prefix",
358
+ "kind": 15,
359
+ "detail": "Remove prefix",
360
+ "documentation": {
361
+ "value": "Remove shortest matching prefix."
362
+ },
363
+ "insertText": "\\${${1:var}#${2:pattern}}",
364
+ "insertTextRules": 4,
365
+ "sortText": "05_trimprefix"
366
+ },
367
+ {
368
+ "label": "string trim suffix",
369
+ "kind": 15,
370
+ "detail": "Remove suffix",
371
+ "documentation": {
372
+ "value": "Remove shortest matching suffix."
373
+ },
374
+ "insertText": "\\${${1:var}%${2:pattern}}",
375
+ "insertTextRules": 4,
376
+ "sortText": "05_trimsuffix"
377
+ },
378
+ {
379
+ "label": "string uppercase",
380
+ "kind": 15,
381
+ "detail": "Uppercase",
382
+ "documentation": {
383
+ "value": "Convert to uppercase."
384
+ },
385
+ "insertText": "\\${(U)${1:var}}",
386
+ "insertTextRules": 4,
387
+ "sortText": "05_upper"
388
+ },
389
+ {
390
+ "label": "string lowercase",
391
+ "kind": 15,
392
+ "detail": "Lowercase",
393
+ "documentation": {
394
+ "value": "Convert to lowercase."
395
+ },
396
+ "insertText": "\\${(L)${1:var}}",
397
+ "insertTextRules": 4,
398
+ "sortText": "05_lower"
399
+ },
400
+ {
401
+ "label": "string split",
402
+ "kind": 15,
403
+ "detail": "Split string",
404
+ "documentation": {
405
+ "value": "Split string into array."
406
+ },
407
+ "insertText": "\\${(s:${1::}:)${2:var}}",
408
+ "insertTextRules": 4,
409
+ "sortText": "05_split"
410
+ },
411
+ {
412
+ "label": "string join",
413
+ "kind": 15,
414
+ "detail": "Join array",
415
+ "documentation": {
416
+ "value": "Join array into string."
417
+ },
418
+ "insertText": "\\${(j:${1::}:)${2:arr}}",
419
+ "insertTextRules": 4,
420
+ "sortText": "05_join"
421
+ },
422
+ {
423
+ "label": "default value",
424
+ "kind": 15,
425
+ "detail": "Default if unset",
426
+ "documentation": {
427
+ "value": "Use default value if unset or empty."
428
+ },
429
+ "insertText": "\\${${1:var}:-${2:default}}",
430
+ "insertTextRules": 4,
431
+ "sortText": "06_default"
432
+ },
433
+ {
434
+ "label": "assign default",
435
+ "kind": 15,
436
+ "detail": "Assign default",
437
+ "documentation": {
438
+ "value": "Assign default if unset."
439
+ },
440
+ "insertText": "\\${${1:var}:=${2:default}}",
441
+ "insertTextRules": 4,
442
+ "sortText": "06_assigndef"
443
+ },
444
+ {
445
+ "label": "error if unset",
446
+ "kind": 15,
447
+ "detail": "Error if unset",
448
+ "documentation": {
449
+ "value": "Error with message if variable is unset."
450
+ },
451
+ "insertText": "\\${${1:var}:?${2:error message}}",
452
+ "insertTextRules": 4,
453
+ "sortText": "06_errorunset"
454
+ },
455
+ {
456
+ "label": "parameter flags",
457
+ "kind": 15,
458
+ "detail": "Zsh param flags",
459
+ "documentation": {
460
+ "value": "Zsh-specific parameter expansion flags."
461
+ },
462
+ "insertText": "# (U) uppercase (L) lowercase (C) capitalize\n# (s:x:) split on x (j:x:) join with x\n# (f) split on newlines (F) join with newlines\n# (u) unique (o) sort (O) reverse sort\n# (S) glob sort (n) numeric sort\n# (k) keys of assoc array (v) values\n# (w) count words (W) count words (whitespace delimited)\n\\${(${1:U})${2:var}}",
463
+ "insertTextRules": 4,
464
+ "sortText": "06_flags"
465
+ },
466
+ {
467
+ "label": "glob qualifiers",
468
+ "kind": 15,
469
+ "detail": "Glob qualifiers",
470
+ "documentation": {
471
+ "value": "Zsh glob qualifiers for advanced file matching."
472
+ },
473
+ "insertText": "# (.) regular files (/) directories (@) symlinks\n# (*) executable (r) readable (w) writable\n# (L+n) size > n bytes (Lk+n) > n KB (Lm+n) > n MB\n# (mh-n) modified < n hours ago (mw-n) < n weeks\n# (on) sort by name (oL) sort by size (om) sort by mtime\n# (On) reverse name sort ([1,5]) first 5 matches\n# (N) null glob (no error if empty)\nprint -l ${1:*}(${2:.})",
474
+ "insertTextRules": 4,
475
+ "sortText": "07_glob"
476
+ },
477
+ {
478
+ "label": "recursive glob",
479
+ "kind": 15,
480
+ "detail": "Recursive glob",
481
+ "documentation": {
482
+ "value": "Match files recursively."
483
+ },
484
+ "insertText": "${1:**/*.${2:txt}}",
485
+ "insertTextRules": 4,
486
+ "sortText": "07_globrec"
487
+ },
488
+ {
489
+ "label": "extended glob",
490
+ "kind": 15,
491
+ "detail": "Extended glob",
492
+ "documentation": {
493
+ "value": "Extended globbing patterns."
494
+ },
495
+ "insertText": "# (#q) glob qualifiers\n# (pattern1|pattern2) alternation\n# ^pattern negation ~pattern exclusion\n# (#cN,M) match N-M times\nsetopt EXTENDED_GLOB\nprint -l ${1:^*.bak}",
496
+ "insertTextRules": 4,
497
+ "sortText": "07_extglob"
498
+ },
499
+ {
500
+ "label": "command substitution",
501
+ "kind": 15,
502
+ "detail": "Command substitution",
503
+ "documentation": {
504
+ "value": "Capture command output."
505
+ },
506
+ "insertText": "\\$(${1:command})",
507
+ "insertTextRules": 4,
508
+ "sortText": "08_cmdsub"
509
+ },
510
+ {
511
+ "label": "process substitution",
127
512
  "kind": 15,
513
+ "detail": "Process substitution",
514
+ "documentation": {
515
+ "value": "Use process output as file."
516
+ },
517
+ "insertText": "${1:diff} <(${2:command1}) <(${3:command2})",
518
+ "insertTextRules": 4,
519
+ "sortText": "08_procsub"
520
+ },
521
+ {
522
+ "label": "background job",
523
+ "kind": 15,
524
+ "detail": "Background &",
525
+ "documentation": {
526
+ "value": "Run command in background."
527
+ },
528
+ "insertText": "${1:command} &\n${2:wait}",
529
+ "insertTextRules": 4,
530
+ "sortText": "08_bg"
531
+ },
532
+ {
533
+ "label": "trap signal",
534
+ "kind": 15,
535
+ "detail": "Trap signal",
536
+ "documentation": {
537
+ "value": "Trap signals for cleanup."
538
+ },
539
+ "insertText": "trap '${1:echo \"Caught signal\"; cleanup}' ${2:INT TERM EXIT}",
540
+ "insertTextRules": 4,
541
+ "sortText": "08_trap"
542
+ },
543
+ {
544
+ "label": "heredoc",
545
+ "kind": 15,
546
+ "detail": "Here document",
547
+ "documentation": {
548
+ "value": "Multi-line string using here document."
549
+ },
550
+ "insertText": "cat <<${1:EOF}\n${2:content with \\$variables expanded}\n${1:EOF}",
551
+ "insertTextRules": 4,
552
+ "sortText": "09_heredoc"
553
+ },
554
+ {
555
+ "label": "heredoc no expansion",
556
+ "kind": 15,
557
+ "detail": "Heredoc literal",
558
+ "documentation": {
559
+ "value": "Here document without variable expansion."
560
+ },
561
+ "insertText": "cat <<'${1:EOF}'\n${2:content without expansion}\n${1:EOF}",
562
+ "insertTextRules": 4,
563
+ "sortText": "09_heredoclit"
564
+ },
565
+ {
566
+ "label": "herestring",
567
+ "kind": 15,
568
+ "detail": "Here string",
569
+ "documentation": {
570
+ "value": "Feed string to command stdin."
571
+ },
572
+ "insertText": "${1:command} <<< \"${2:string}\"",
573
+ "insertTextRules": 4,
574
+ "sortText": "09_herestring"
575
+ },
576
+ {
577
+ "label": "redirect stderr",
578
+ "kind": 15,
579
+ "detail": "Redirect stderr",
580
+ "documentation": {
581
+ "value": "Redirect stderr to file or stdout."
582
+ },
583
+ "insertText": "${1:command} 2>${2:/dev/null}",
584
+ "insertTextRules": 4,
585
+ "sortText": "09_redir"
586
+ },
587
+ {
588
+ "label": "redirect both",
589
+ "kind": 15,
590
+ "detail": "Redirect all output",
591
+ "documentation": {
592
+ "value": "Redirect both stdout and stderr."
593
+ },
594
+ "insertText": "${1:command} &> ${2:/dev/null}",
595
+ "insertTextRules": 4,
596
+ "sortText": "09_redirboth"
597
+ },
598
+ {
599
+ "label": "alias",
600
+ "kind": 14,
601
+ "detail": "Alias",
602
+ "documentation": {
603
+ "value": "Define a command alias."
604
+ },
605
+ "insertText": "alias ${1:name}='${2:command}'",
606
+ "insertTextRules": 4,
607
+ "sortText": "10_alias"
608
+ },
609
+ {
610
+ "label": "global alias",
611
+ "kind": 14,
612
+ "detail": "Global alias",
613
+ "documentation": {
614
+ "value": "Global alias - expanded anywhere on command line."
615
+ },
616
+ "insertText": "alias -g ${1:G}='${2:| grep}'",
617
+ "insertTextRules": 4,
618
+ "sortText": "10_galias"
619
+ },
620
+ {
621
+ "label": "suffix alias",
622
+ "kind": 14,
623
+ "detail": "Suffix alias",
624
+ "documentation": {
625
+ "value": "Open files by extension."
626
+ },
627
+ "insertText": "alias -s ${1:txt}='${2:vim}'",
628
+ "insertTextRules": 4,
629
+ "sortText": "10_salias"
630
+ },
631
+ {
632
+ "label": "source",
633
+ "kind": 14,
634
+ "detail": "Source file",
635
+ "documentation": {
636
+ "value": "Execute commands from a file in current shell."
637
+ },
638
+ "insertText": "source ${1:~/.zshrc}",
639
+ "insertTextRules": 4,
640
+ "sortText": "10_source"
641
+ },
642
+ {
643
+ "label": "autoload",
644
+ "kind": 14,
128
645
  "detail": "Autoload function",
129
646
  "documentation": {
130
- "value": "Autoload a zsh function."
647
+ "value": "Lazy-load a function from fpath."
131
648
  },
132
- "insertText": "autoload -Uz ${1:compinit} && ${1:compinit}",
649
+ "insertText": "autoload -Uz ${1:function_name}",
133
650
  "insertTextRules": 4,
134
- "sortText": "02_autoload"
651
+ "sortText": "10_autoload"
135
652
  },
136
653
  {
137
654
  "label": "setopt",
138
655
  "kind": 14,
139
656
  "detail": "Set option",
140
657
  "documentation": {
141
- "value": "Enable a zsh option."
658
+ "value": "Enable a shell option."
142
659
  },
143
- "insertText": "setopt ${1:AUTO_CD}",
660
+ "insertText": "setopt ${1:OPTION_NAME}",
144
661
  "insertTextRules": 4,
145
- "sortText": "03_setopt"
662
+ "sortText": "11_setopt"
663
+ },
664
+ {
665
+ "label": "setopt common",
666
+ "kind": 15,
667
+ "detail": "Common options",
668
+ "documentation": {
669
+ "value": "Commonly used zsh options."
670
+ },
671
+ "insertText": "setopt AUTO_CD # cd without typing cd\nsetopt AUTO_PUSHD # Push dirs to stack\nsetopt PUSHD_IGNORE_DUPS\nsetopt GLOB_DOTS # Include dotfiles in glob\nsetopt EXTENDED_GLOB # Extended pattern matching\nsetopt NO_CASE_GLOB # Case insensitive glob\nsetopt NUMERIC_GLOB_SORT # Sort globs numerically\nsetopt CORRECT # Spelling correction\nsetopt CORRECT_ALL # Correct all arguments\nsetopt INTERACTIVE_COMMENTS # Allow comments in interactive",
672
+ "insertTextRules": 4,
673
+ "sortText": "11_setopt_common"
674
+ },
675
+ {
676
+ "label": "history config",
677
+ "kind": 15,
678
+ "detail": "History setup",
679
+ "documentation": {
680
+ "value": "Complete history configuration."
681
+ },
682
+ "insertText": "HISTFILE=~/.zsh_history\nHISTSIZE=50000\nSAVEHIST=50000\nsetopt SHARE_HISTORY # Share across sessions\nsetopt HIST_EXPIRE_DUPS_FIRST # Expire dups first\nsetopt HIST_IGNORE_DUPS # Don't record dups\nsetopt HIST_IGNORE_ALL_DUPS # Remove older dup\nsetopt HIST_FIND_NO_DUPS # Skip dups in search\nsetopt HIST_IGNORE_SPACE # Skip space-prefixed\nsetopt HIST_SAVE_NO_DUPS\nsetopt HIST_VERIFY # Show before executing\nsetopt INC_APPEND_HISTORY # Append immediately",
683
+ "insertTextRules": 4,
684
+ "sortText": "12_history"
685
+ },
686
+ {
687
+ "label": "compinit",
688
+ "kind": 15,
689
+ "detail": "Completion init",
690
+ "documentation": {
691
+ "value": "Initialize the completion system."
692
+ },
693
+ "insertText": "autoload -Uz compinit\ncompinit\n\nzstyle ':completion:*' menu select\nzstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'\nzstyle ':completion:*' list-colors \\${(s.:.)LS_COLORS}\nzstyle ':completion:*' use-cache on\nzstyle ':completion:*' cache-path ~/.zsh/cache",
694
+ "insertTextRules": 4,
695
+ "sortText": "13_compinit"
696
+ },
697
+ {
698
+ "label": "compdef",
699
+ "kind": 14,
700
+ "detail": "Completion definition",
701
+ "documentation": {
702
+ "value": "Define completion for a command."
703
+ },
704
+ "insertText": "compdef ${1:_gnu_generic} ${2:command}",
705
+ "insertTextRules": 4,
706
+ "sortText": "13_compdef"
707
+ },
708
+ {
709
+ "label": "completion function",
710
+ "kind": 3,
711
+ "detail": "Custom completion",
712
+ "documentation": {
713
+ "value": "Write a custom completion function."
714
+ },
715
+ "insertText": "_${1:mycommand}() {\n local -a subcmds\n subcmds=(\n 'start:Start the service'\n 'stop:Stop the service'\n 'status:Show status'\n )\n _describe 'command' subcmds\n}\ncompdef _${1:mycommand} ${1:mycommand}",
716
+ "insertTextRules": 4,
717
+ "sortText": "13_compfunc"
718
+ },
719
+ {
720
+ "label": "zstyle",
721
+ "kind": 14,
722
+ "detail": "Zstyle",
723
+ "documentation": {
724
+ "value": "Configure completion behavior."
725
+ },
726
+ "insertText": "zstyle '${1::completion:*}' ${2:menu} ${3:select}",
727
+ "insertTextRules": 4,
728
+ "sortText": "13_zstyle"
146
729
  },
147
730
  {
148
731
  "label": "bindkey",
149
732
  "kind": 14,
150
733
  "detail": "Key binding",
151
734
  "documentation": {
152
- "value": "Bind a key sequence to a widget."
735
+ "value": "Bind a key to a ZLE widget."
153
736
  },
154
737
  "insertText": "bindkey '${1:^R}' ${2:history-incremental-search-backward}",
155
738
  "insertTextRules": 4,
156
- "sortText": "03_bindkey"
739
+ "sortText": "14_bindkey"
157
740
  },
158
741
  {
159
- "label": "zstyle",
160
- "kind": 14,
161
- "detail": "Completion style",
742
+ "label": "bindkey vi mode",
743
+ "kind": 15,
744
+ "detail": "Vi mode",
162
745
  "documentation": {
163
- "value": "Configure completion system styling."
746
+ "value": "Enable vi mode keybindings."
164
747
  },
165
- "insertText": "zstyle ':completion:*' ${1:menu} ${2:select}",
748
+ "insertText": "bindkey -v\n\n# Keep useful emacs bindings in vi mode:\nbindkey '^R' history-incremental-search-backward\nbindkey '^A' beginning-of-line\nbindkey '^E' end-of-line\nbindkey '^K' kill-line\n\n# Reduce mode switch delay:\nexport KEYTIMEOUT=1",
166
749
  "insertTextRules": 4,
167
- "sortText": "03_zstyle"
750
+ "sortText": "14_bindkey_vi"
751
+ },
752
+ {
753
+ "label": "custom widget",
754
+ "kind": 15,
755
+ "detail": "ZLE widget",
756
+ "documentation": {
757
+ "value": "Create a custom ZLE widget."
758
+ },
759
+ "insertText": "${1:my-widget}() {\n ${2:BUFFER=\"\\$BUFFER modified\"}\n zle redisplay\n}\nzle -N ${1:my-widget}\nbindkey '${3:^X^M}' ${1:my-widget}",
760
+ "insertTextRules": 4,
761
+ "sortText": "14_widget"
168
762
  },
169
763
  {
170
764
  "label": "PROMPT",
765
+ "kind": 6,
766
+ "detail": "Prompt variable",
767
+ "documentation": {
768
+ "value": "Set the left prompt."
769
+ },
770
+ "insertText": "PROMPT='${1:%F{cyan}%n@%m%f %F{yellow}%~%f %# }'",
771
+ "insertTextRules": 4,
772
+ "sortText": "15_prompt"
773
+ },
774
+ {
775
+ "label": "RPROMPT",
776
+ "kind": 6,
777
+ "detail": "Right prompt",
778
+ "documentation": {
779
+ "value": "Set the right-side prompt."
780
+ },
781
+ "insertText": "RPROMPT='${1:%F{gray}%*%f}'",
782
+ "insertTextRules": 4,
783
+ "sortText": "15_rprompt"
784
+ },
785
+ {
786
+ "label": "prompt with git",
171
787
  "kind": 15,
172
- "detail": "Custom prompt",
788
+ "detail": "Git prompt",
789
+ "documentation": {
790
+ "value": "Prompt with git branch info."
791
+ },
792
+ "insertText": "autoload -Uz vcs_info\nprecmd() { vcs_info }\nzstyle ':vcs_info:git:*' formats ' %F{magenta}(%b)%f'\nsetopt PROMPT_SUBST\nPROMPT='%F{cyan}%~%f\\${vcs_info_msg_0_} %# '",
793
+ "insertTextRules": 4,
794
+ "sortText": "15_prompt_git"
795
+ },
796
+ {
797
+ "label": "precmd hook",
798
+ "kind": 3,
799
+ "detail": "Precmd hook",
800
+ "documentation": {
801
+ "value": "Function run before each prompt."
802
+ },
803
+ "insertText": "precmd() {\n ${1:# Runs before each prompt display}\n}",
804
+ "insertTextRules": 4,
805
+ "sortText": "16_precmd"
806
+ },
807
+ {
808
+ "label": "preexec hook",
809
+ "kind": 3,
810
+ "detail": "Preexec hook",
811
+ "documentation": {
812
+ "value": "Function run before each command."
813
+ },
814
+ "insertText": "preexec() {\n ${1:# \\$1 = typed command, \\$2 = expanded, \\$3 = full}\n}",
815
+ "insertTextRules": 4,
816
+ "sortText": "16_preexec"
817
+ },
818
+ {
819
+ "label": "chpwd hook",
820
+ "kind": 3,
821
+ "detail": "Chpwd hook",
173
822
  "documentation": {
174
- "value": "Set custom prompt."
823
+ "value": "Function run when directory changes."
175
824
  },
176
- "insertText": "PROMPT='%F{${1:green}}%n@%m%f:%F{${2:blue}}%~%f$ '",
825
+ "insertText": "chpwd() {\n ${1:ls}\n}",
177
826
  "insertTextRules": 4,
178
- "sortText": "04_prompt"
827
+ "sortText": "16_chpwd"
179
828
  },
180
829
  {
181
- "label": "oh-my-zsh",
830
+ "label": "add-zsh-hook",
831
+ "kind": 14,
832
+ "detail": "Add named hook",
833
+ "documentation": {
834
+ "value": "Add a function to a hook array (allows multiple)."
835
+ },
836
+ "insertText": "autoload -Uz add-zsh-hook\nadd-zsh-hook ${1:precmd} ${2:my_function}",
837
+ "insertTextRules": 4,
838
+ "sortText": "16_addhook"
839
+ },
840
+ {
841
+ "label": "PATH append",
842
+ "kind": 14,
843
+ "detail": "Append to PATH",
844
+ "documentation": {
845
+ "value": "Add directory to end of PATH."
846
+ },
847
+ "insertText": "export PATH=\"\\$PATH:${1:/usr/local/bin}\"",
848
+ "insertTextRules": 4,
849
+ "sortText": "17_path"
850
+ },
851
+ {
852
+ "label": "PATH prepend",
853
+ "kind": 14,
854
+ "detail": "Prepend to PATH",
855
+ "documentation": {
856
+ "value": "Add directory to beginning of PATH."
857
+ },
858
+ "insertText": "export PATH=\"${1:\\$HOME/.local/bin}:\\$PATH\"",
859
+ "insertTextRules": 4,
860
+ "sortText": "17_pathpre"
861
+ },
862
+ {
863
+ "label": "path array",
864
+ "kind": 6,
865
+ "detail": "Zsh path array",
866
+ "documentation": {
867
+ "value": "Use zsh path array (lowercase, tied to PATH)."
868
+ },
869
+ "insertText": "typeset -U path # unique entries\npath=(${1:\\$HOME/.local/bin} \\$path)",
870
+ "insertTextRules": 4,
871
+ "sortText": "17_patharray"
872
+ },
873
+ {
874
+ "label": "oh-my-zsh setup",
182
875
  "kind": 15,
183
876
  "detail": "Oh My Zsh config",
184
877
  "documentation": {
185
- "value": "Basic Oh My Zsh configuration."
878
+ "value": "Oh My Zsh configuration."
186
879
  },
187
- "insertText": "export ZSH=\"$HOME/.oh-my-zsh\"\nZSH_THEME=\"${1:robbyrussell}\"\nplugins=(${2:git docker kubectl})\nsource $ZSH/oh-my-zsh.sh",
880
+ "insertText": "export ZSH=\"\\$HOME/.oh-my-zsh\"\nZSH_THEME=\"${1:robbyrussell}\"\nplugins=(\n ${2:git}\n ${3:docker}\n ${4:kubectl}\n ${5:z}\n zsh-autosuggestions\n zsh-syntax-highlighting\n)\nsource \\$ZSH/oh-my-zsh.sh",
188
881
  "insertTextRules": 4,
189
- "sortText": "05_omz"
882
+ "sortText": "18_omz"
190
883
  },
191
884
  {
192
- "label": "zinit plugin",
885
+ "label": "zinit setup",
193
886
  "kind": 15,
194
- "detail": "Zinit plugin load",
887
+ "detail": "Zinit config",
195
888
  "documentation": {
196
- "value": "Load a plugin with Zinit."
889
+ "value": "Zinit plugin manager configuration."
197
890
  },
198
- "insertText": "zinit light ${1:zsh-users/zsh-autosuggestions}",
891
+ "insertText": "source \"\\$HOME/.local/share/zinit/zinit.git/zinit.zsh\"\n\nzinit light zsh-users/zsh-autosuggestions\nzinit light zsh-users/zsh-syntax-highlighting\nzinit light zsh-users/zsh-completions\n\nzinit ice depth=1; zinit light romkatv/powerlevel10k",
199
892
  "insertTextRules": 4,
200
- "sortText": "05_zinit"
893
+ "sortText": "18_zinit"
201
894
  },
202
895
  {
203
- "label": "completion function",
896
+ "label": "zmodload",
897
+ "kind": 14,
898
+ "detail": "Load module",
899
+ "documentation": {
900
+ "value": "Load a zsh module."
901
+ },
902
+ "insertText": "zmodload ${1:zsh/datetime}",
903
+ "insertTextRules": 4,
904
+ "sortText": "19_zmodload"
905
+ },
906
+ {
907
+ "label": "zparseopts",
204
908
  "kind": 15,
205
- "detail": "Custom completion",
909
+ "detail": "Parse options",
910
+ "documentation": {
911
+ "value": "Parse command-line options (zsh built-in)."
912
+ },
913
+ "insertText": "zparseopts -D -E -- \\\n h=help -help=help \\\n v=verbose -verbose=verbose \\\n o:=output -output:=output\n\nif (( \\${#help} )); then\n echo \"Usage: \\$0 [-h] [-v] [-o output]\"\n return 0\nfi\n\n[[ -n \\$output ]] && output=\\${output[2]}",
914
+ "insertTextRules": 4,
915
+ "sortText": "20_zparseopts"
916
+ },
917
+ {
918
+ "label": "getopts",
919
+ "kind": 15,
920
+ "detail": "Getopts parsing",
921
+ "documentation": {
922
+ "value": "POSIX-compatible option parsing."
923
+ },
924
+ "insertText": "while getopts '${1:hvo:}' opt; do\n case \\$opt in\n h) echo \"Usage: ...\"; return 0 ;;\n v) verbose=1 ;;\n o) output=\\$OPTARG ;;\n ?) echo \"Invalid option\" >&2; return 1 ;;\n esac\ndone\nshift \\$((OPTIND - 1))",
925
+ "insertTextRules": 4,
926
+ "sortText": "20_getopts"
927
+ },
928
+ {
929
+ "label": "test file exists",
930
+ "kind": 15,
931
+ "detail": "File exists?",
932
+ "documentation": {
933
+ "value": "Check if file exists."
934
+ },
935
+ "insertText": "if [[ -f ${1:\"\\$file\"} ]]; then\n ${2:echo \"File exists\"}\nfi",
936
+ "insertTextRules": 4,
937
+ "sortText": "21_testf"
938
+ },
939
+ {
940
+ "label": "test directory",
941
+ "kind": 15,
942
+ "detail": "Directory exists?",
943
+ "documentation": {
944
+ "value": "Check if directory exists."
945
+ },
946
+ "insertText": "if [[ -d ${1:\"\\$dir\"} ]]; then\n ${2:echo \"Directory exists\"}\nfi",
947
+ "insertTextRules": 4,
948
+ "sortText": "21_testd"
949
+ },
950
+ {
951
+ "label": "test string empty",
952
+ "kind": 15,
953
+ "detail": "String empty?",
954
+ "documentation": {
955
+ "value": "Check if variable is empty."
956
+ },
957
+ "insertText": "if [[ -z ${1:\"\\$var\"} ]]; then\n ${2:echo \"Empty\"}\nfi",
958
+ "insertTextRules": 4,
959
+ "sortText": "21_testz"
960
+ },
961
+ {
962
+ "label": "test command exists",
963
+ "kind": 15,
964
+ "detail": "Command exists?",
206
965
  "documentation": {
207
- "value": "Define a custom completion function."
966
+ "value": "Check if command is available."
208
967
  },
209
- "insertText": "_${1:mycommand}() {\n local -a opts\n opts=(\n '${2:option1}:${3:description}'\n )\n _describe 'command' opts\n}\ncompdef _${1:mycommand} ${1:mycommand}",
968
+ "insertText": "if (( \\$+commands[${1:docker}] )); then\n ${2:echo \"docker is installed\"}\nfi",
210
969
  "insertTextRules": 4,
211
- "sortText": "05_compdef"
970
+ "sortText": "21_testcmd"
212
971
  }
213
972
  ]
214
973
  }