@@ -213,181 +213,223 @@ You can check the [configuration documentation](https://github.com/bassamsdata/n
213
213
<summary >Here's the full setup with defaults:</summary >
214
214
215
215
``` lua
216
- M .config = {
217
- AllowKinds = {
218
- default = {
219
- " Function" ,
220
- " Method" ,
221
- " Class" ,
222
- " Module" ,
223
- " Property" ,
224
- " Variable" ,
225
- -- "Constant",
226
- -- "Enum",
227
- -- "Interface",
228
- -- "Field",
229
- -- "Struct",
230
- },
231
- go = {
232
- " Function" ,
233
- " Method" ,
234
- " Struct" , -- For struct definitions
235
- " Field" , -- For struct fields
236
- " Interface" ,
237
- " Constant" ,
238
- -- "Variable",
239
- " Property" ,
240
- -- "TypeParameter", -- For type parameters if using generics
241
- },
242
- lua = { " Function" , " Method" , " Table" , " Module" },
243
- python = { " Function" , " Class" , " Method" },
244
- -- Filetype specific
245
- yaml = { " Object" , " Array" },
246
- json = { " Module" },
247
- toml = { " Object" },
248
- markdown = { " String" },
249
- },
250
- BlockList = {
251
- default = {},
252
- -- Filetype-specific
253
- lua = {
254
- " ^vim%." , -- anonymous functions passed to nvim api
255
- " %.%.%. :" , -- vim.iter functions
256
- " :gsub" , -- lua string.gsub
257
- " ^callback$" , -- nvim autocmds
258
- " ^filter$" ,
259
- " ^map$" , -- nvim keymaps
260
- },
261
- -- another example:
262
- -- python = { "^__" }, -- ignore __init__ functions
263
- },
264
- display = {
265
- mode = " text" , -- "icon" or "raw"
266
- padding = 2 ,
267
- },
268
- kindText = {
269
- Function = " function" ,
270
- Method = " method" ,
271
- Class = " class" ,
272
- Module = " module" ,
273
- Constructor = " constructor" ,
274
- Interface = " interface" ,
275
- Property = " property" ,
276
- Field = " field" ,
277
- Enum = " enum" ,
278
- Constant = " constant" ,
279
- Variable = " variable" ,
280
- },
281
- kindIcons = {
282
- File = " " ,
283
- Module = " " ,
284
- Namespace = " " ,
285
- Package = " " ,
286
- Class = " " ,
287
- Method = " " ,
288
- Property = " " ,
289
- Field = " " ,
290
- Constructor = " " ,
291
- Enum = " " ,
292
- Interface = " " ,
293
- Function = " " ,
294
- Variable = " " ,
295
- Constant = " " ,
296
- String = " " ,
297
- Number = " " ,
298
- Boolean = " " ,
299
- Array = " " ,
300
- Object = " " ,
301
- Key = " " ,
302
- Null = " " ,
303
- EnumMember = " " ,
304
- Struct = " " ,
305
- Event = " " ,
306
- Operator = " " ,
307
- TypeParameter = " " ,
308
- },
309
- preview = {
310
- highlight_on_move = true , -- Whether to highlight symbols as you move through them
311
- -- TODO: still needs implmenting, keep it always now
312
- highlight_mode = " always" , -- "always" | "select" (only highlight when selecting)
313
- },
314
- icon = " " , -- - - --
315
- highlight = " NamuPreview" ,
316
- highlights = {
317
- parent = " NamuParent" ,
318
- nested = " NamuNested" ,
319
- style = " NamuStyle" ,
320
- },
321
- kinds = {
322
- prefix_kind_colors = true ,
323
- enable_highlights = true ,
324
- highlights = {
325
- PrefixSymbol = " NamuPrefixSymbol" ,
326
- Function = " NamuSymbolFunction" ,
327
- Method = " NamuSymbolMethod" ,
328
- Class = " NamuSymbolClass" ,
329
- Interface = " NamuSymbolInterface" ,
330
- Variable = " NamuSymbolVariable" ,
331
- Constant = " NamuSymbolConstant" ,
332
- Property = " NamuSymbolProperty" ,
333
- Field = " NamuSymbolField" ,
334
- Enum = " NamuSymbolEnum" ,
335
- Module = " NamuSymbolModule" ,
336
- },
337
- },
338
- window = {
339
- auto_size = true ,
340
- min_width = 30 ,
341
- padding = 4 ,
342
- border = " rounded" ,
343
- show_footer = true ,
344
- footer_pos = " right" ,
345
- },
346
- debug = false , -- Debug flag for both namu and selecta
347
- focus_current_symbol = true , -- Add this option to control the feature
348
- auto_select = false ,
349
- row_position = " top10" , -- options: "center"|"top10",
350
- initially_hidden = false ,
351
- multiselect = {
352
- enabled = true ,
353
- indicator = " ●" , -- or "✓"
354
- keymaps = {
355
- toggle = " <Tab>" ,
356
- untoggle = " <S-Tab>" ,
357
- select_all = " <C-a>" ,
358
- clear_all = " <C-l>" ,
359
- },
360
- max_items = nil , -- No limit by default
361
- },
362
- actions = {
363
- close_on_yank = false , -- Whether to close picker after yanking
364
- close_on_delete = true , -- Whether to close picker after deleting
365
- },
366
- custom_keymaps = {
367
- yank = {
368
- keys = { " <C-y>" },
369
- desc = " Yank symbol text" ,
370
- },
371
- delete = {
372
- keys = { " <C-d>" },
373
- },
374
- vertical_split = {
375
- keys = { " <C-v>" },
376
- desc = " Open in vertical split" ,
377
- },
378
- horizontal_split = {
379
- keys = { " <C-h>" },
380
- desc = " Open in horizontal split" ,
381
- },
382
- codecompanion = {
383
- keys = " <C-o>" ,
384
- desc = " Add symbol to CodeCompanion" ,
385
- },
386
- avante = {
387
- keys = " <C-t>" ,
388
- desc = " Add symbol to Avante" ,
389
- },
390
- },
216
+ { -- Those are the default options
217
+ " bassamsdata/namu.nvim" ,
218
+ config = function ()
219
+ require (" namu" ).setup ({
220
+ -- Enable symbols navigator which is the default
221
+ namu_symbols = {
222
+ enable = true ,
223
+ --- @type NamuConfig
224
+ options = {
225
+ AllowKinds = {
226
+ default = {
227
+ " Function" ,
228
+ " Method" ,
229
+ " Class" ,
230
+ " Module" ,
231
+ " Property" ,
232
+ " Variable" ,
233
+ -- "Constant",
234
+ -- "Enum",
235
+ -- "Interface",
236
+ -- "Field",
237
+ -- "Struct",
238
+ },
239
+ go = {
240
+ " Function" ,
241
+ " Method" ,
242
+ " Struct" , -- For struct definitions
243
+ " Field" , -- For struct fields
244
+ " Interface" ,
245
+ " Constant" ,
246
+ -- "Variable",
247
+ " Property" ,
248
+ -- "TypeParameter", -- For type parameters if using generics
249
+ },
250
+ lua = { " Function" , " Method" , " Table" , " Module" },
251
+ python = { " Function" , " Class" , " Method" },
252
+ -- Filetype specific
253
+ yaml = { " Object" , " Array" },
254
+ json = { " Module" },
255
+ toml = { " Object" },
256
+ markdown = { " String" },
257
+ },
258
+ BlockList = {
259
+ default = {},
260
+ -- Filetype-specific
261
+ lua = {
262
+ " ^vim%." , -- anonymous functions passed to nvim api
263
+ " %.%.%. :" , -- vim.iter functions
264
+ " :gsub" , -- lua string.gsub
265
+ " ^callback$" , -- nvim autocmds
266
+ " ^filter$" ,
267
+ " ^map$" , -- nvim keymaps
268
+ },
269
+ -- another example:
270
+ -- python = { "^__" }, -- ignore __init__ functions
271
+ },
272
+ display = {
273
+ mode = " icon" , -- "icon" or "raw"
274
+ padding = 2 ,
275
+ },
276
+ -- This is a preset that let's set window without really get into the hassle of tuning window options
277
+ -- top10 meaning top 10% of the window
278
+ row_position = " top10" , -- options: "center"|"top10"|"top10_right"|"center_right"|"bottom",
279
+ preview = {
280
+ highlight_on_move = true , -- Whether to highlight symbols as you move through them
281
+ -- still needs implmenting, keep it always now
282
+ highlight_mode = " always" , -- "always" | "select" (only highlight when selecting)
283
+ },
284
+ window = {
285
+ auto_size = true ,
286
+ min_height = 1 ,
287
+ min_width = 20 ,
288
+ max_width = 120 ,
289
+ max_height = 30 ,
290
+ padding = 2 ,
291
+ border = " rounded" ,
292
+ title_pos = " left" ,
293
+ show_footer = true ,
294
+ footer_pos = " right" ,
295
+ relative = " editor" ,
296
+ style = " minimal" ,
297
+ width_ratio = 0.6 ,
298
+ height_ratio = 0.6 ,
299
+ title_prefix = " " ,
300
+ },
301
+ debug = false ,
302
+ focus_current_symbol = true ,
303
+ auto_select = false ,
304
+ initially_hidden = false ,
305
+ multiselect = {
306
+ enabled = true ,
307
+ indicator = " ✓" , -- or "✓"●
308
+ keymaps = {
309
+ toggle = " <Tab>" ,
310
+ untoggle = " <S-Tab>" ,
311
+ select_all = " <C-a>" ,
312
+ clear_all = " <C-l>" ,
313
+ },
314
+ max_items = nil , -- No limit by default
315
+ },
316
+ actions = {
317
+ close_on_yank = false , -- Whether to close picker after yanking
318
+ close_on_delete = true , -- Whether to close picker after deleting
319
+ },
320
+ movement = {-- Support multiple keys
321
+ next = { " <C-n>" , " <DOWN>" },
322
+ previous = { " <C-p>" , " <UP>" },
323
+ close = { " <ESC>" }, -- "<C-c>" can be added as well
324
+ select = { " <CR>" },
325
+ delete_word = {}, -- it can assign "<C-w>"
326
+ clear_line = {}, -- it can be "<C-u>"
327
+ },
328
+ custom_keymaps = {
329
+ yank = {
330
+ keys = { " <C-y>" },
331
+ desc = " Yank symbol text" ,
332
+ },
333
+ delete = {
334
+ keys = { " <C-d>" },
335
+ desc = " Delete symbol text" ,
336
+ },
337
+ vertical_split = {
338
+ keys = { " <C-v>" },
339
+ desc = " Open in vertical split" ,
340
+ },
341
+ horizontal_split = {
342
+ keys = { " <C-h>" },
343
+ desc = " Open in horizontal split" ,
344
+ },
345
+ codecompanion = {
346
+ keys = " <C-o>" ,
347
+ desc = " Add symbol to CodeCompanion" ,
348
+ },
349
+ avante = {
350
+ keys = " <C-t>" ,
351
+ desc = " Add symbol to Avante" ,
352
+ },
353
+ },
354
+ icon = " " , -- - - --
355
+ kindText = {
356
+ Function = " function" ,
357
+ Class = " class" ,
358
+ Module = " module" ,
359
+ Constructor = " constructor" ,
360
+ Interface = " interface" ,
361
+ Property = " property" ,
362
+ Field = " field" ,
363
+ Enum = " enum" ,
364
+ Constant = " constant" ,
365
+ Variable = " variable" ,
366
+ },
367
+ kindIcons = {
368
+ File = " " ,
369
+ Module = " " ,
370
+ Namespace = " " ,
371
+ Package = " " ,
372
+ Class = " " ,
373
+ Method = " " ,
374
+ Property = " " ,
375
+ Field = " " ,
376
+ Constructor = " " ,
377
+ Enum = " " ,
378
+ Interface = " " ,
379
+ Function = " " ,
380
+ Variable = " " ,
381
+ Constant = " " ,
382
+ String = " " ,
383
+ Number = " " ,
384
+ Boolean = " " ,
385
+ Array = " " ,
386
+ Object = " " ,
387
+ Key = " " ,
388
+ Null = " " ,
389
+ EnumMember = " " ,
390
+ Struct = " " ,
391
+ Event = " " ,
392
+ Operator = " " ,
393
+ TypeParameter = " " ,
394
+ },
395
+ highlight = " NamuPreview" ,
396
+ highlights = {
397
+ parent = " NamuParent" ,
398
+ nested = " NamuNested" ,
399
+ style = " NamuStyle" ,
400
+ },
401
+ kinds = {
402
+ prefix_kind_colors = true ,
403
+ enable_highlights = true ,
404
+ highlights = {
405
+ PrefixSymbol = " NamuPrefixSymbol" ,
406
+ Function = " NamuSymbolFunction" ,
407
+ Method = " NamuSymbolMethod" ,
408
+ Class = " NamuSymbolClass" ,
409
+ Interface = " NamuSymbolInterface" ,
410
+ Variable = " NamuSymbolVariable" ,
411
+ Constant = " NamuSymbolConstant" ,
412
+ Property = " NamuSymbolProperty" ,
413
+ Field = " NamuSymbolField" ,
414
+ Enum = " NamuSymbolEnum" ,
415
+ Module = " NamuSymbolModule" ,
416
+ },
417
+ },
418
+ }
419
+ }
420
+ colorscheme = {
421
+ enable = false ,
422
+ options = {
423
+ -- NOTE: if you activate persist, then please remove any vim.cmd("colorscheme ...") in your config, no needed anymore
424
+ persist = true , -- very efficient mechanism to Remember selected colorscheme
425
+ write_shada = false , -- If you open multiple nvim instances, then probably you need to enable this
426
+ excluded_schemes = {}, -- exclude any colorscheme from the list
427
+ -- it accept the same row_position and movement keys as the one in namy symbols
428
+ },
429
+ },
430
+ ui_select = { enable = false }, -- vim.ui.select() wrapper
431
+ })
432
+ end ,
391
433
}
392
434
```
393
435
0 commit comments