@icarusmx/creta 1.5.16 → 1.5.18
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.
|
@@ -1,80 +1,270 @@
|
|
|
1
1
|
export const curl = {
|
|
2
2
|
command: 'curl',
|
|
3
|
-
description: 'Realiza peticiones HTTP desde la terminal -
|
|
3
|
+
description: 'Realiza peticiones HTTP desde la terminal - para APIs y descargar scripts',
|
|
4
4
|
usage: 'curl [opciones] [URL]',
|
|
5
|
+
|
|
6
|
+
learningPath: {
|
|
7
|
+
intro: 'curl tiene dos usos principales: trabajar con APIs y descargar scripts',
|
|
8
|
+
progression: [
|
|
9
|
+
'Primero: Aprende cada flag individual (-L, -s, -f, -S)',
|
|
10
|
+
'Segundo: Combínalos para formar -fsSL',
|
|
11
|
+
'Tercero: Úsalo en instalaciones reales (curl -fsSL url | bash)',
|
|
12
|
+
'Cuarto: Aplícalo a APIs REST (-X, -H, -d)'
|
|
13
|
+
],
|
|
14
|
+
goal: 'Dominar -fsSL te hace ver profesional. Lo verás en toda instalación de herramientas.'
|
|
15
|
+
},
|
|
16
|
+
|
|
5
17
|
commonOptions: [
|
|
6
18
|
{
|
|
7
|
-
flag: '-
|
|
8
|
-
description: '
|
|
19
|
+
flag: '-L',
|
|
20
|
+
description: 'Sigue redirects automáticamente',
|
|
21
|
+
why: 'Las URLs pueden redirigir. Sin -L, curl se detiene en la primera respuesta',
|
|
22
|
+
example: 'curl -L https://bit.ly/ejemplo',
|
|
23
|
+
level: 1
|
|
9
24
|
},
|
|
10
25
|
{
|
|
11
|
-
flag: '-
|
|
12
|
-
description: '
|
|
26
|
+
flag: '-s',
|
|
27
|
+
description: 'Modo silencioso - oculta la barra de progreso',
|
|
28
|
+
why: 'El progreso es ruido visual cuando haces piping o scripts',
|
|
29
|
+
example: 'curl -s https://api.ejemplo.com | jq',
|
|
30
|
+
level: 2
|
|
13
31
|
},
|
|
14
32
|
{
|
|
15
|
-
flag: '-
|
|
16
|
-
description: '
|
|
33
|
+
flag: '-f',
|
|
34
|
+
description: 'Falla visiblemente en errores HTTP (400+, 500+)',
|
|
35
|
+
why: 'Sin esto, curl devuelve el HTML de error como si fuera éxito',
|
|
36
|
+
example: 'curl -f https://api.ejemplo.com/404',
|
|
37
|
+
level: 3
|
|
17
38
|
},
|
|
18
39
|
{
|
|
19
|
-
flag: '-
|
|
20
|
-
description: '
|
|
40
|
+
flag: '-S',
|
|
41
|
+
description: 'Muestra errores incluso en modo silencioso',
|
|
42
|
+
why: 'Para combinar con -s: silencioso pero con errores visibles',
|
|
43
|
+
example: 'curl -sS https://api.ejemplo.com',
|
|
44
|
+
level: 4
|
|
21
45
|
},
|
|
22
46
|
{
|
|
23
|
-
flag: '-
|
|
24
|
-
description: '
|
|
47
|
+
flag: '-fsSL',
|
|
48
|
+
description: 'EL COMBO DEFINITIVO - Siempre úsalo para instalar herramientas',
|
|
49
|
+
why: 'Combina todo: fail on error + silent + show errors + follow redirects',
|
|
50
|
+
example: 'curl -fsSL https://deno.land/install.sh | bash',
|
|
51
|
+
level: 5,
|
|
52
|
+
note: 'Este patrón aparece en TODAS las instalaciones profesionales'
|
|
25
53
|
},
|
|
26
54
|
{
|
|
27
|
-
flag: '-
|
|
28
|
-
description: '
|
|
55
|
+
flag: '-X METHOD',
|
|
56
|
+
description: 'Especifica método HTTP: GET, POST, PUT, DELETE',
|
|
57
|
+
context: 'APIs REST',
|
|
58
|
+
example: 'curl -X POST https://api.ejemplo.com/users'
|
|
29
59
|
},
|
|
30
60
|
{
|
|
31
|
-
flag: '-
|
|
32
|
-
description: '
|
|
61
|
+
flag: '-H "Header: valor"',
|
|
62
|
+
description: 'Agrega headers HTTP a la petición',
|
|
63
|
+
context: 'Content-Type, Authorization, etc.',
|
|
64
|
+
example: 'curl -H "Content-Type: application/json"'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
flag: '-d "data"',
|
|
68
|
+
description: 'Envía datos en el body (JSON, form data)',
|
|
69
|
+
context: 'POST/PUT requests',
|
|
70
|
+
example: 'curl -d \'{"nombre": "Juan"}\''
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
flag: '-i',
|
|
74
|
+
description: 'Incluye headers de respuesta en output',
|
|
75
|
+
context: 'Ver status codes: 200 OK, 404 Not Found, 500 Error',
|
|
76
|
+
example: 'curl -i https://api.ejemplo.com'
|
|
33
77
|
},
|
|
34
78
|
{
|
|
35
79
|
flag: '-v',
|
|
36
|
-
description: 'Modo verbose
|
|
80
|
+
description: 'Modo verbose - muestra request y response completos',
|
|
81
|
+
context: 'Debugging profundo',
|
|
82
|
+
example: 'curl -v https://api.ejemplo.com'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
flag: '-o archivo',
|
|
86
|
+
description: 'Guarda output en archivo',
|
|
87
|
+
context: 'Descargar recursos',
|
|
88
|
+
example: 'curl -o data.json https://api.ejemplo.com/data'
|
|
37
89
|
}
|
|
38
90
|
],
|
|
91
|
+
|
|
39
92
|
examples: [
|
|
40
93
|
{
|
|
41
|
-
|
|
42
|
-
|
|
94
|
+
title: 'LA PROGRESIÓN: Construyendo hacia -fsSL',
|
|
95
|
+
commands: [
|
|
96
|
+
{
|
|
97
|
+
command: 'curl https://api.github.com',
|
|
98
|
+
step: 'Paso 1: GET básico',
|
|
99
|
+
output: 'Verás barra de progreso y datos',
|
|
100
|
+
problema: 'Demasiado ruido visual'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
command: 'curl -L https://nodejs.org/install',
|
|
104
|
+
step: 'Paso 2: + sigue redirects',
|
|
105
|
+
output: 'Sigue automáticamente si la URL redirige',
|
|
106
|
+
mejora: 'Ahora funciona con URLs acortadas'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
command: 'curl -sL https://nodejs.org/install',
|
|
110
|
+
step: 'Paso 3: + modo silencioso',
|
|
111
|
+
output: 'Sin barra de progreso, solo datos',
|
|
112
|
+
mejora: 'Output limpio, listo para piping'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
command: 'curl -fsSL https://deno.land/install.sh',
|
|
116
|
+
step: 'Paso 4: + falla en errores + muestra errores',
|
|
117
|
+
output: 'El combo completo',
|
|
118
|
+
nivel: 'PROFESIONAL - Memoriza esto'
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
command: 'curl -fsSL https://deno.land/install.sh | bash',
|
|
122
|
+
step: 'Paso 5: + ejecuta con piping',
|
|
123
|
+
output: 'Descarga e instala en un comando',
|
|
124
|
+
uso: 'Así instalan los profesionales'
|
|
125
|
+
}
|
|
126
|
+
]
|
|
43
127
|
},
|
|
44
128
|
{
|
|
45
|
-
|
|
46
|
-
|
|
129
|
+
title: 'CASOS REALES: Instalaciones que verás constantemente',
|
|
130
|
+
commands: [
|
|
131
|
+
{
|
|
132
|
+
command: 'curl -fsSL https://get.docker.com | sh',
|
|
133
|
+
tool: 'Docker',
|
|
134
|
+
note: 'Containerización'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
command: 'curl -fsSL https://deno.land/install.sh | sh',
|
|
138
|
+
tool: 'Deno',
|
|
139
|
+
note: 'Runtime de JavaScript/TypeScript'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
command: 'curl -fsSL https://sh.rustup.rs | sh',
|
|
143
|
+
tool: 'Rust',
|
|
144
|
+
note: 'Lenguaje de sistemas'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
command: 'curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash',
|
|
148
|
+
tool: 'Homebrew',
|
|
149
|
+
note: 'Package manager para macOS'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
command: 'curl -fsSL https://get.pnpm.io/install.sh | sh',
|
|
153
|
+
tool: 'pnpm',
|
|
154
|
+
note: 'Package manager rápido'
|
|
155
|
+
}
|
|
156
|
+
]
|
|
47
157
|
},
|
|
48
158
|
{
|
|
49
|
-
|
|
50
|
-
|
|
159
|
+
title: 'TRABAJANDO CON APIs REST',
|
|
160
|
+
commands: [
|
|
161
|
+
{
|
|
162
|
+
command: 'curl https://api.github.com/users/octocat',
|
|
163
|
+
use: 'GET simple - API pública',
|
|
164
|
+
response: 'JSON con datos del usuario'
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
command: 'curl -X POST https://httpbin.org/post -H "Content-Type: application/json" -d \'{"nombre": "Juan", "edad": 25}\'',
|
|
168
|
+
use: 'POST con JSON - enviar datos',
|
|
169
|
+
response: 'Echo del servidor con tus datos'
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
command: 'curl -H "Authorization: Bearer TOKEN" https://api.ejemplo.com/protected',
|
|
173
|
+
use: 'GET autenticado - API privada',
|
|
174
|
+
response: 'Recursos protegidos'
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
command: 'curl -X PUT https://api.ejemplo.com/users/123 -H "Content-Type: application/json" -d \'{"nombre": "Juan Actualizado"}\'',
|
|
178
|
+
use: 'PUT - actualizar recurso',
|
|
179
|
+
response: 'Recurso modificado'
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
command: 'curl -X DELETE https://api.ejemplo.com/users/123 -H "Authorization: Bearer TOKEN"',
|
|
183
|
+
use: 'DELETE - eliminar recurso',
|
|
184
|
+
response: 'Confirmación de eliminación'
|
|
185
|
+
}
|
|
186
|
+
]
|
|
51
187
|
},
|
|
52
188
|
{
|
|
53
|
-
|
|
54
|
-
|
|
189
|
+
title: 'DEBUGGING: Cuando las cosas no funcionan',
|
|
190
|
+
commands: [
|
|
191
|
+
{
|
|
192
|
+
command: 'curl -i https://api.ejemplo.com',
|
|
193
|
+
purpose: 'Ver headers de respuesta',
|
|
194
|
+
verás: 'HTTP/1.1 200 OK, Content-Type, etc.'
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
command: 'curl -v https://api.ejemplo.com',
|
|
198
|
+
purpose: 'Ver comunicación completa',
|
|
199
|
+
verás: 'Request headers, response headers, handshake SSL, etc.'
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
command: 'curl -f https://api.ejemplo.com/404',
|
|
203
|
+
purpose: 'Forzar error visible en 404/500',
|
|
204
|
+
verás: 'curl: (22) The requested URL returned error: 404'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
command: 'curl -w "\\nStatus: %{http_code}\\n" https://api.ejemplo.com',
|
|
208
|
+
purpose: 'Mostrar solo el status code',
|
|
209
|
+
verás: 'Status: 200'
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
|
|
215
|
+
relatedLesson: 'APIs y HTTP',
|
|
216
|
+
|
|
217
|
+
tips: [
|
|
218
|
+
'REGLA DE ORO: curl -fsSL url | bash es el patrón universal para instalaciones',
|
|
219
|
+
'Desglose de -fsSL: (f)ail on error + (s)ilent + (S)how errors + (L)ocation',
|
|
220
|
+
'Para APIs: curl -X POST -H "Content-Type: application/json" -d \'{"key":"val"}\'',
|
|
221
|
+
'Para ver status codes: curl -i (headers) o curl -v (todo)',
|
|
222
|
+
'Siempre usa -L con URLs acortadas o que pueden redirigir'
|
|
223
|
+
],
|
|
224
|
+
|
|
225
|
+
commonMistakes: [
|
|
226
|
+
{
|
|
227
|
+
error: 'Olvidar -L cuando la URL redirige',
|
|
228
|
+
resultado: 'Verás HTML de redirect en vez del recurso',
|
|
229
|
+
solución: 'Siempre agrega -L por defecto'
|
|
55
230
|
},
|
|
56
231
|
{
|
|
57
|
-
|
|
58
|
-
|
|
232
|
+
error: 'No usar -f en scripts automatizados',
|
|
233
|
+
resultado: 'curl "tiene éxito" incluso con 404/500',
|
|
234
|
+
solución: 'Usa -f para que falle visiblemente'
|
|
59
235
|
},
|
|
60
236
|
{
|
|
61
|
-
|
|
62
|
-
|
|
237
|
+
error: 'Usar -v en scripts de producción',
|
|
238
|
+
resultado: 'Logs llenos de ruido innecesario',
|
|
239
|
+
solución: 'Usa -i para ver solo headers o -s para silencio'
|
|
63
240
|
},
|
|
64
241
|
{
|
|
65
|
-
|
|
66
|
-
|
|
242
|
+
error: 'Olvidar comillas en JSON',
|
|
243
|
+
resultado: 'curl -d {"key":"value"} falla (bash interpreta las llaves)',
|
|
244
|
+
solución: 'Siempre usa comillas simples: -d \'{"key":"value"}\''
|
|
67
245
|
},
|
|
68
246
|
{
|
|
69
|
-
|
|
70
|
-
|
|
247
|
+
error: 'No especificar Content-Type en POST',
|
|
248
|
+
resultado: 'El servidor no entiende el formato',
|
|
249
|
+
solución: 'Siempre agrega -H "Content-Type: application/json"'
|
|
71
250
|
}
|
|
72
251
|
],
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
252
|
+
|
|
253
|
+
proTips: [
|
|
254
|
+
{
|
|
255
|
+
tip: 'Combina curl con jq para parsear JSON',
|
|
256
|
+
command: 'curl -s https://api.github.com/users/octocat | jq .name',
|
|
257
|
+
output: '"The Octocat"'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
tip: 'Usa alias para curl -fsSL',
|
|
261
|
+
command: 'alias curlsh="curl -fsSL"',
|
|
262
|
+
entonces: 'curlsh https://ejemplo.com/install.sh | bash'
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
tip: 'Guarda cookies para sesiones',
|
|
266
|
+
command: 'curl -c cookies.txt -d "user=juan" https://ejemplo.com/login',
|
|
267
|
+
luego: 'curl -b cookies.txt https://ejemplo.com/dashboard'
|
|
268
|
+
}
|
|
79
269
|
]
|
|
80
270
|
}
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
# Understanding LazyVim Plugin Architecture
|
|
2
|
+
|
|
3
|
+
<!-- vim: set foldmethod=marker foldlevel=0: -->
|
|
4
|
+
|
|
5
|
+
## 📖 LazyVim Reading Guide {{{
|
|
6
|
+
|
|
7
|
+
**Start with:** `zM` (close all folds) → Navigate with `za` (toggle fold)
|
|
8
|
+
|
|
9
|
+
**Keys for navigation:**
|
|
10
|
+
- `}` - Jump to next section
|
|
11
|
+
- `{` - Jump to previous section
|
|
12
|
+
- `zM` - Close all folds (overview mode)
|
|
13
|
+
- `zR` - Open all folds (detailed mode)
|
|
14
|
+
|
|
15
|
+
}}}
|
|
16
|
+
|
|
17
|
+
## 🎯 Purpose {{{
|
|
18
|
+
|
|
19
|
+
**What:** Understand your LazyVim plugin configuration structure
|
|
20
|
+
**Why:** Know where to add/modify plugins without breaking your setup
|
|
21
|
+
**Time:** 20 minutes
|
|
22
|
+
**Level:** 🟡 Intermediate
|
|
23
|
+
|
|
24
|
+
**Entrypoint for ariadna nvim configuration:**
|
|
25
|
+
`~/.config/nvim/lua/plugins/`
|
|
26
|
+
|
|
27
|
+
Each `.lua` file = one plugin configuration (auto-loaded by LazyVim)
|
|
28
|
+
|
|
29
|
+
}}}
|
|
30
|
+
|
|
31
|
+
## Plugin Configuration Locations {{{
|
|
32
|
+
|
|
33
|
+
### Two Important Directories {{{
|
|
34
|
+
|
|
35
|
+
1. **`~/.config/nvim/lua/config/`** - LazyVim core settings
|
|
36
|
+
- `lazy.lua` - Plugin manager setup
|
|
37
|
+
- `options.lua` - Vim options (tab width, line numbers, etc)
|
|
38
|
+
- `keymaps.lua` - Custom keybindings
|
|
39
|
+
- `autocmds.lua` - Auto-commands (events)
|
|
40
|
+
|
|
41
|
+
2. **`~/.config/nvim/lua/plugins/`** - Your plugin overrides
|
|
42
|
+
- Each file adds/modifies plugins
|
|
43
|
+
- Auto-loaded alphabetically
|
|
44
|
+
- This is where YOU make changes
|
|
45
|
+
|
|
46
|
+
}}}
|
|
47
|
+
|
|
48
|
+
### Current Plugin Files {{{
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
~/.config/nvim/lua/plugins/
|
|
52
|
+
├── colorscheme.lua # Theme (Catppuccin Latte)
|
|
53
|
+
├── example.lua # Reference examples (disabled)
|
|
54
|
+
├── markdown.lua # Markdown rendering + Glow preview
|
|
55
|
+
├── neo-tree.lua # File explorer filters
|
|
56
|
+
├── svelte.lua # Svelte support
|
|
57
|
+
└── telescope_noignore.lua # Search hidden/ignored files
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
}}}
|
|
61
|
+
|
|
62
|
+
}}}
|
|
63
|
+
|
|
64
|
+
## Part 1: Color Scheme Configuration {{{
|
|
65
|
+
|
|
66
|
+
### File: `colorscheme.lua` {{{
|
|
67
|
+
|
|
68
|
+
**Location:** `~/.config/nvim/lua/plugins/colorscheme.lua`
|
|
69
|
+
|
|
70
|
+
**Purpose:** Override LazyVim's default theme
|
|
71
|
+
|
|
72
|
+
**Current Setup:**
|
|
73
|
+
```lua
|
|
74
|
+
return {
|
|
75
|
+
{
|
|
76
|
+
"catppuccin/nvim",
|
|
77
|
+
name = "catppuccin",
|
|
78
|
+
priority = 1000,
|
|
79
|
+
opts = {
|
|
80
|
+
flavour = "latte", -- Light theme
|
|
81
|
+
transparent_background = true, -- See terminal bg
|
|
82
|
+
color_overrides = {
|
|
83
|
+
latte = {
|
|
84
|
+
blue = "#1e66f5", -- Vibrant blues
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"LazyVim/LazyVim",
|
|
91
|
+
opts = {
|
|
92
|
+
colorscheme = "catppuccin",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**To change theme:**
|
|
99
|
+
1. Edit this file
|
|
100
|
+
2. Save
|
|
101
|
+
3. Run `:Lazy sync` in nvim
|
|
102
|
+
4. Restart nvim
|
|
103
|
+
|
|
104
|
+
}}}
|
|
105
|
+
|
|
106
|
+
### Practice: Try Different Flavors {{{
|
|
107
|
+
|
|
108
|
+
Catppuccin has 4 flavors. Try changing `flavour = "latte"` to:
|
|
109
|
+
|
|
110
|
+
- `"latte"` - Light (current)
|
|
111
|
+
- `"frappe"` - Light-ish
|
|
112
|
+
- `"macchiato"` - Dark-ish
|
|
113
|
+
- `"mocha"` - Dark
|
|
114
|
+
|
|
115
|
+
**Exercise:**
|
|
116
|
+
1. Open `~/.config/nvim/lua/plugins/colorscheme.lua`
|
|
117
|
+
2. Change `flavour = "mocha"`
|
|
118
|
+
3. Save (`:w`)
|
|
119
|
+
4. Quit nvim (`:q`)
|
|
120
|
+
5. Reopen nvim
|
|
121
|
+
6. Notice the dark theme
|
|
122
|
+
7. Change back to `"latte"` if you prefer light
|
|
123
|
+
|
|
124
|
+
}}}
|
|
125
|
+
|
|
126
|
+
}}}
|
|
127
|
+
|
|
128
|
+
## Part 2: Markdown Workflow {{{
|
|
129
|
+
|
|
130
|
+
### File: `markdown.lua` {{{
|
|
131
|
+
|
|
132
|
+
**Two plugins for different needs:**
|
|
133
|
+
|
|
134
|
+
1. **render-markdown.nvim** - Inline preview
|
|
135
|
+
- Auto-renders when you open `.md` files
|
|
136
|
+
- Shows formatted headings, code blocks, bullets
|
|
137
|
+
- Works in normal mode (not insert)
|
|
138
|
+
|
|
139
|
+
2. **glow.nvim** - Full preview
|
|
140
|
+
- Press `Shift+L` to open terminal preview
|
|
141
|
+
- Better for reviewing whole documents
|
|
142
|
+
- Dark theme, 120 char width
|
|
143
|
+
|
|
144
|
+
**When to use which:**
|
|
145
|
+
- Editing docs → render-markdown (always on)
|
|
146
|
+
- Reviewing docs → Shift+L for glow
|
|
147
|
+
- Presenting docs → Shift+L for clean view
|
|
148
|
+
|
|
149
|
+
}}}
|
|
150
|
+
|
|
151
|
+
### Practice: Test Markdown Preview {{{
|
|
152
|
+
|
|
153
|
+
**Exercise:**
|
|
154
|
+
1. Create a test markdown file: `nvim ~/test-doc.md`
|
|
155
|
+
2. Type this content:
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
# Test Document
|
|
159
|
+
|
|
160
|
+
This is a **bold** paragraph with some *italic* text.
|
|
161
|
+
|
|
162
|
+
## Code Example
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
console.log("Hello from markdown!");
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- Bullet one
|
|
169
|
+
- Bullet two
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
3. Save (`:w`) and notice render-markdown formatting
|
|
173
|
+
4. Press `Shift+L` to see Glow preview
|
|
174
|
+
5. Press `q` to exit Glow
|
|
175
|
+
6. Delete the test file: `:!rm %`
|
|
176
|
+
|
|
177
|
+
}}}
|
|
178
|
+
|
|
179
|
+
}}}
|
|
180
|
+
|
|
181
|
+
## Part 3: Project-Specific Configs {{{
|
|
182
|
+
|
|
183
|
+
### File: `neo-tree.lua` {{{
|
|
184
|
+
|
|
185
|
+
**Hides config clutter from file explorer**
|
|
186
|
+
|
|
187
|
+
Files hidden:
|
|
188
|
+
- `eslint.config.js`
|
|
189
|
+
- `jsconfig.json`
|
|
190
|
+
- `vite.config.js`
|
|
191
|
+
- `svelte.config.js`
|
|
192
|
+
- `package-lock.json`
|
|
193
|
+
- `.prettierrc`, `.prettierignore`
|
|
194
|
+
- `.npmrc`, `.gitignore`
|
|
195
|
+
|
|
196
|
+
**Why:** Keep file tree focused on actual code
|
|
197
|
+
|
|
198
|
+
**To modify:**
|
|
199
|
+
Add filenames to the `hide_by_name` and `never_show` arrays.
|
|
200
|
+
|
|
201
|
+
}}}
|
|
202
|
+
|
|
203
|
+
### File: `svelte.lua` {{{
|
|
204
|
+
|
|
205
|
+
**Sets up Svelte development:**
|
|
206
|
+
|
|
207
|
+
1. Treesitter parsers: svelte, html, css, js, ts
|
|
208
|
+
2. Svelte LSP with Svelte 5 support
|
|
209
|
+
3. Disables annoying a11y warnings
|
|
210
|
+
|
|
211
|
+
**Critical for icarus.mx work**
|
|
212
|
+
|
|
213
|
+
**The config:**
|
|
214
|
+
```lua
|
|
215
|
+
return {
|
|
216
|
+
-- Treesitter parsers
|
|
217
|
+
{
|
|
218
|
+
"nvim-treesitter/nvim-treesitter",
|
|
219
|
+
opts = function(_, opts)
|
|
220
|
+
vim.list_extend(opts.ensure_installed, {
|
|
221
|
+
"svelte", "html", "css", "javascript", "typescript",
|
|
222
|
+
})
|
|
223
|
+
end,
|
|
224
|
+
},
|
|
225
|
+
-- LSP support
|
|
226
|
+
{
|
|
227
|
+
"neovim/nvim-lspconfig",
|
|
228
|
+
opts = {
|
|
229
|
+
servers = {
|
|
230
|
+
svelte = {
|
|
231
|
+
settings = {
|
|
232
|
+
svelte = {
|
|
233
|
+
plugin = {
|
|
234
|
+
svelte = {
|
|
235
|
+
compilerWarnings = {
|
|
236
|
+
["a11y-autofocus"] = "ignore",
|
|
237
|
+
["a11y-click-events-have-key-events"] = "ignore",
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
}}}
|
|
251
|
+
|
|
252
|
+
### File: `telescope_noignore.lua` {{{
|
|
253
|
+
|
|
254
|
+
**Overrides LazyVim defaults to search EVERYTHING:**
|
|
255
|
+
|
|
256
|
+
- `--hidden` - Search dotfiles
|
|
257
|
+
- `--no-ignore` - Search node_modules, .git, etc.
|
|
258
|
+
- Shows gitignored files in neo-tree
|
|
259
|
+
|
|
260
|
+
**When you need it:**
|
|
261
|
+
- Finding files in node_modules
|
|
262
|
+
- Debugging .git issues
|
|
263
|
+
- Exploring hidden config files
|
|
264
|
+
|
|
265
|
+
**The config:**
|
|
266
|
+
```lua
|
|
267
|
+
return {
|
|
268
|
+
{
|
|
269
|
+
"nvim-telescope/telescope.nvim",
|
|
270
|
+
opts = function(_, opts)
|
|
271
|
+
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
|
272
|
+
vimgrep_arguments = {
|
|
273
|
+
"rg", "--color=never", "--no-heading",
|
|
274
|
+
"--with-filename", "--line-number", "--column",
|
|
275
|
+
"--smart-case", "--hidden", "--no-ignore",
|
|
276
|
+
},
|
|
277
|
+
})
|
|
278
|
+
opts.pickers = vim.tbl_deep_extend("force", opts.pickers or {}, {
|
|
279
|
+
find_files = {
|
|
280
|
+
find_command = { "rg", "--files", "--hidden", "--no-ignore" },
|
|
281
|
+
},
|
|
282
|
+
})
|
|
283
|
+
end,
|
|
284
|
+
},
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
}}}
|
|
289
|
+
|
|
290
|
+
}}}
|
|
291
|
+
|
|
292
|
+
## Part 4: Adding New Plugins {{{
|
|
293
|
+
|
|
294
|
+
### The Pattern {{{
|
|
295
|
+
|
|
296
|
+
**Create a new file:** `~/.config/nvim/lua/plugins/my-plugin.lua`
|
|
297
|
+
|
|
298
|
+
```lua
|
|
299
|
+
return {
|
|
300
|
+
{
|
|
301
|
+
"author/plugin-name",
|
|
302
|
+
opts = {
|
|
303
|
+
-- plugin options here
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**LazyVim automatically loads it** - no imports needed!
|
|
310
|
+
|
|
311
|
+
}}}
|
|
312
|
+
|
|
313
|
+
### Example: Add GitHub Copilot {{{
|
|
314
|
+
|
|
315
|
+
**File:** `~/.config/nvim/lua/plugins/copilot.lua`
|
|
316
|
+
|
|
317
|
+
```lua
|
|
318
|
+
return {
|
|
319
|
+
{
|
|
320
|
+
"zbirenbaum/copilot.lua",
|
|
321
|
+
cmd = "Copilot",
|
|
322
|
+
event = "InsertEnter",
|
|
323
|
+
opts = {
|
|
324
|
+
suggestion = { enabled = true, auto_trigger = true },
|
|
325
|
+
panel = { enabled = true },
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Save → `:Lazy sync` → Restart → Done
|
|
332
|
+
|
|
333
|
+
}}}
|
|
334
|
+
|
|
335
|
+
### Example: Add a File Icon Theme {{{
|
|
336
|
+
|
|
337
|
+
**File:** `~/.config/nvim/lua/plugins/devicons.lua`
|
|
338
|
+
|
|
339
|
+
```lua
|
|
340
|
+
return {
|
|
341
|
+
{
|
|
342
|
+
"nvim-tree/nvim-web-devicons",
|
|
343
|
+
opts = {
|
|
344
|
+
override = {
|
|
345
|
+
md = {
|
|
346
|
+
icon = "📝",
|
|
347
|
+
color = "#519aba",
|
|
348
|
+
name = "Markdown",
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
This changes the markdown file icon in neo-tree and telescope.
|
|
357
|
+
|
|
358
|
+
}}}
|
|
359
|
+
|
|
360
|
+
### Practice: Add Your Own Plugin {{{
|
|
361
|
+
|
|
362
|
+
**Exercise: Add a TODO comment highlighter**
|
|
363
|
+
|
|
364
|
+
1. Create the file:
|
|
365
|
+
```bash
|
|
366
|
+
nvim ~/.config/nvim/lua/plugins/todo-comments.lua
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
2. Add this config:
|
|
370
|
+
```lua
|
|
371
|
+
return {
|
|
372
|
+
{
|
|
373
|
+
"folke/todo-comments.nvim",
|
|
374
|
+
dependencies = { "nvim-lua/plenary.nvim" },
|
|
375
|
+
opts = {
|
|
376
|
+
signs = true,
|
|
377
|
+
keywords = {
|
|
378
|
+
TODO = { icon = "✓", color = "info" },
|
|
379
|
+
HACK = { icon = "⚠", color = "warning" },
|
|
380
|
+
WARN = { icon = "⚠", color = "warning" },
|
|
381
|
+
NOTE = { icon = "ℹ", color = "hint" },
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
3. Save and run `:Lazy sync`
|
|
389
|
+
4. Restart nvim
|
|
390
|
+
5. Try it in a JavaScript file:
|
|
391
|
+
|
|
392
|
+
```javascript
|
|
393
|
+
// TODO: This will be highlighted
|
|
394
|
+
// HACK: So will this
|
|
395
|
+
// NOTE: And this too
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
6. Search todos with `:TodoTelescope`
|
|
399
|
+
|
|
400
|
+
}}}
|
|
401
|
+
|
|
402
|
+
}}}
|
|
403
|
+
|
|
404
|
+
## Part 5: Understanding Plugin Loading {{{
|
|
405
|
+
|
|
406
|
+
### How LazyVim Loads Plugins {{{
|
|
407
|
+
|
|
408
|
+
When nvim starts:
|
|
409
|
+
|
|
410
|
+
1. Reads `~/.config/nvim/lua/config/lazy.lua`
|
|
411
|
+
2. This file tells Lazy.nvim to load all files in `plugins/`
|
|
412
|
+
3. Each `.lua` file returns a table of plugin specs
|
|
413
|
+
4. Lazy.nvim merges all specs together
|
|
414
|
+
5. Plugins install/load based on events (`VeryLazy`, `InsertEnter`, etc.)
|
|
415
|
+
|
|
416
|
+
**Key insight:** Files in `plugins/` don't need to import each other. They're all loaded automatically.
|
|
417
|
+
|
|
418
|
+
}}}
|
|
419
|
+
|
|
420
|
+
### Plugin Loading Events {{{
|
|
421
|
+
|
|
422
|
+
Common events you'll see:
|
|
423
|
+
|
|
424
|
+
- `VeryLazy` - Load after startup (most plugins)
|
|
425
|
+
- `InsertEnter` - Load when entering insert mode
|
|
426
|
+
- `BufRead` - Load when reading a buffer
|
|
427
|
+
- `FileType` - Load for specific file types
|
|
428
|
+
- `cmd` - Load when command is run
|
|
429
|
+
|
|
430
|
+
**Example:**
|
|
431
|
+
```lua
|
|
432
|
+
return {
|
|
433
|
+
{
|
|
434
|
+
"ellisonleao/glow.nvim",
|
|
435
|
+
cmd = "Glow", -- Only loads when :Glow is run
|
|
436
|
+
ft = { "markdown" }, -- Only for .md files
|
|
437
|
+
},
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
This keeps nvim startup fast!
|
|
442
|
+
|
|
443
|
+
}}}
|
|
444
|
+
|
|
445
|
+
### Overriding vs Extending {{{
|
|
446
|
+
|
|
447
|
+
**Overriding** - Replace default config:
|
|
448
|
+
```lua
|
|
449
|
+
opts = {
|
|
450
|
+
theme = "latte", -- Replaces entire opts table
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**Extending** - Add to default config:
|
|
455
|
+
```lua
|
|
456
|
+
opts = function(_, opts)
|
|
457
|
+
vim.list_extend(opts.ensure_installed, {
|
|
458
|
+
"svelte", -- Adds to existing list
|
|
459
|
+
})
|
|
460
|
+
end
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**Use `opts = function` when you want to keep LazyVim defaults.**
|
|
464
|
+
|
|
465
|
+
}}}
|
|
466
|
+
|
|
467
|
+
}}}
|
|
468
|
+
|
|
469
|
+
## Part 6: Debugging Plugin Issues {{{
|
|
470
|
+
|
|
471
|
+
### Common Issues {{{
|
|
472
|
+
|
|
473
|
+
**1. Plugin not loading**
|
|
474
|
+
```vim
|
|
475
|
+
:Lazy " Open Lazy.nvim UI
|
|
476
|
+
:Lazy log " Check for errors
|
|
477
|
+
:Lazy sync " Force re-sync
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
**2. Config not applying**
|
|
481
|
+
- Did you save the file?
|
|
482
|
+
- Did you restart nvim?
|
|
483
|
+
- Did you run `:Lazy sync`?
|
|
484
|
+
|
|
485
|
+
**3. Conflicting configs**
|
|
486
|
+
- Check if another file overrides the same plugin
|
|
487
|
+
- LazyVim loads files alphabetically
|
|
488
|
+
- Later files can override earlier ones
|
|
489
|
+
|
|
490
|
+
}}}
|
|
491
|
+
|
|
492
|
+
### Useful Commands {{{
|
|
493
|
+
|
|
494
|
+
```vim
|
|
495
|
+
:Lazy " Open plugin manager UI
|
|
496
|
+
:Lazy update " Update all plugins
|
|
497
|
+
:Lazy sync " Install/update/clean plugins
|
|
498
|
+
:Lazy clean " Remove unused plugins
|
|
499
|
+
:Lazy profile " See plugin load times
|
|
500
|
+
:Lazy log " View error logs
|
|
501
|
+
|
|
502
|
+
:checkhealth " Check nvim health
|
|
503
|
+
:LspInfo " Check LSP status
|
|
504
|
+
:Mason " Manage LSP/formatters
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
}}}
|
|
508
|
+
|
|
509
|
+
### Practice: Debug a Plugin {{{
|
|
510
|
+
|
|
511
|
+
**Exercise:**
|
|
512
|
+
|
|
513
|
+
1. Open Lazy UI: `:Lazy`
|
|
514
|
+
2. Press `p` to see profile (load times)
|
|
515
|
+
3. Press `l` to see logs
|
|
516
|
+
4. Find the `catppuccin` plugin
|
|
517
|
+
5. Press `?` to see help
|
|
518
|
+
6. Press `q` to close
|
|
519
|
+
|
|
520
|
+
This UI shows you:
|
|
521
|
+
- Which plugins are installed
|
|
522
|
+
- Load order and timing
|
|
523
|
+
- Error messages
|
|
524
|
+
- Update status
|
|
525
|
+
|
|
526
|
+
}}}
|
|
527
|
+
|
|
528
|
+
}}}
|
|
529
|
+
|
|
530
|
+
## 🎯 Outcomes {{{
|
|
531
|
+
|
|
532
|
+
After this exercise, you can:
|
|
533
|
+
|
|
534
|
+
✅ Find where your plugins are configured
|
|
535
|
+
✅ Modify existing plugin settings
|
|
536
|
+
✅ Add new plugins without breaking LazyVim
|
|
537
|
+
✅ Understand the difference between `config/` and `plugins/`
|
|
538
|
+
✅ Know your Neovim ariadna entrypoint: `~/.config/nvim/lua/plugins/`
|
|
539
|
+
✅ Debug plugin issues using `:Lazy` commands
|
|
540
|
+
✅ Extend vs override plugin configs
|
|
541
|
+
✅ Use lazy loading for fast startup
|
|
542
|
+
|
|
543
|
+
**Next Steps:**
|
|
544
|
+
- Explore `example.lua` for more patterns
|
|
545
|
+
- Try adding a plugin you've been wanting
|
|
546
|
+
- Customize keybindings in a new plugin file
|
|
547
|
+
- Browse LazyVim extras: `:LazyExtras`
|
|
548
|
+
|
|
549
|
+
}}}
|
|
550
|
+
|
|
551
|
+
## 🧭 Reference Links {{{
|
|
552
|
+
|
|
553
|
+
- LazyVim docs: https://lazyvim.org
|
|
554
|
+
- Lazy.nvim plugin manager: https://github.com/folke/lazy.nvim
|
|
555
|
+
- Catppuccin theme: https://github.com/catppuccin/nvim
|
|
556
|
+
- Plugin examples: `~/.config/nvim/lua/plugins/example.lua`
|
|
557
|
+
- LazyVim plugins list: https://www.lazyvim.org/plugins
|
|
558
|
+
|
|
559
|
+
**Your actual config:**
|
|
560
|
+
- Main directory: `~/.config/nvim/`
|
|
561
|
+
- Plugin configs: `~/.config/nvim/lua/plugins/`
|
|
562
|
+
- Core settings: `~/.config/nvim/lua/config/`
|
|
563
|
+
|
|
564
|
+
}}}
|
package/lib/exercises/README.md
CHANGED
|
@@ -112,6 +112,12 @@ Each phase builds on knowledge from previous phases.
|
|
|
112
112
|
**Time:** Design exercise
|
|
113
113
|
**Level:** 🔴 Advanced
|
|
114
114
|
|
|
115
|
+
### 15. [Understanding LazyVim Plugin Architecture](./15-nvim-plugin-architecture.md)
|
|
116
|
+
**What:** Master your Neovim plugin configuration structure
|
|
117
|
+
**Why:** Add/modify plugins without breaking your setup
|
|
118
|
+
**Time:** 20 minutes
|
|
119
|
+
**Level:** 🟡 Intermediate
|
|
120
|
+
|
|
115
121
|
---
|
|
116
122
|
|
|
117
123
|
## 🎯 How to Use These Guides
|
|
@@ -153,6 +159,10 @@ Prefer to browse by subject?
|
|
|
153
159
|
- [Shell Aliases](./13-shell-aliases.md)
|
|
154
160
|
- [curl + Pipes](./06-curl-and-pipes.md)
|
|
155
161
|
|
|
162
|
+
### Neovim Configuration
|
|
163
|
+
- [Developing Muscle Memory for Neovim](./01-developing-muscle-for-nvim.md)
|
|
164
|
+
- [Understanding LazyVim Plugin Architecture](./15-nvim-plugin-architecture.md)
|
|
165
|
+
|
|
156
166
|
### JavaScript & Development
|
|
157
167
|
- [Array & Object Manipulation](./04-array-object-manipulation.md)
|
|
158
168
|
- [SvelteKit First Steps](./05-svelte-first-steps.md)
|
|
@@ -170,6 +180,7 @@ Prefer to browse by subject?
|
|
|
170
180
|
|
|
171
181
|
### Meta/Tooling
|
|
172
182
|
- [Install Skills Command](./12-install-skills.md)
|
|
183
|
+
- [Understanding LazyVim Plugin Architecture](./15-nvim-plugin-architecture.md)
|
|
173
184
|
|
|
174
185
|
---
|
|
175
186
|
|