Skip to content

Commit 98e4421

Browse files
committed
(all) Update to properly store default config.
1 parent 9a9a7d4 commit 98e4421

33 files changed

+66
-66
lines changed

lua/mini/ai.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ end
10331033

10341034
-- Helper data ================================================================
10351035
-- Module default config
1036-
H.default_config = MiniAi.config
1036+
H.default_config = vim.deepcopy(MiniAi.config)
10371037

10381038
-- Cache for various operations
10391039
H.cache = {}
@@ -1096,7 +1096,7 @@ H.setup_config = function(config)
10961096
-- General idea: if some table elements are not present in user-supplied
10971097
-- `config`, take them from default config
10981098
vim.validate({ config = { config, 'table', true } })
1099-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1099+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
11001100

11011101
vim.validate({
11021102
custom_textobjects = { config.custom_textobjects, 'table', true },

lua/mini/align.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ end
12271227

12281228
-- Helper data ================================================================
12291229
-- Module default config
1230-
H.default_config = MiniAlign.config
1230+
H.default_config = vim.deepcopy(MiniAlign.config)
12311231

12321232
-- Cache for various operations
12331233
H.cache = {}
@@ -1292,7 +1292,7 @@ H.setup_config = function(config)
12921292
-- General idea: if some table elements are not present in user-supplied
12931293
-- `config`, take them from default config
12941294
vim.validate({ config = { config, 'table', true } })
1295-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1295+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
12961296

12971297
vim.validate({
12981298
mappings = { config.mappings, 'table' },

lua/mini/animate.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ end
11241124

11251125
-- Helper data ================================================================
11261126
-- Module default config
1127-
H.default_config = MiniAnimate.config
1127+
H.default_config = vim.deepcopy(MiniAnimate.config)
11281128

11291129
-- Cache for various operations
11301130
H.cache = {
@@ -1178,7 +1178,7 @@ H.setup_config = function(config)
11781178
-- General idea: if some table elements are not present in user-supplied
11791179
-- `config`, take them from default config
11801180
vim.validate({ config = { config, 'table', true } })
1181-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1181+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
11821182

11831183
vim.validate({
11841184
cursor = { config.cursor, H.is_config_cursor },

lua/mini/base16.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,15 @@ end
340340

341341
-- Helper data ================================================================
342342
-- Module default config
343-
H.default_config = MiniBase16.config
343+
H.default_config = vim.deepcopy(MiniBase16.config)
344344

345345
-- Helper functionality =======================================================
346346
-- Settings -------------------------------------------------------------------
347347
H.setup_config = function(config)
348348
-- General idea: if some table elements are not present in user-supplied
349349
-- `config`, take them from default config
350350
vim.validate({ config = { config, 'table', true } })
351-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
351+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
352352

353353
-- Validate settings
354354
H.validate_base16_palette(config.palette, 'config.palette')

lua/mini/basics.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ end
379379

380380
-- Helper data ================================================================
381381
-- Module default config
382-
H.default_config = MiniBasics.config
382+
H.default_config = vim.deepcopy(MiniBasics.config)
383383

384384
-- Diagnostic state per buffer
385385
H.buffer_diagnostic_state = {}
@@ -390,7 +390,7 @@ H.setup_config = function(config)
390390
-- General idea: if some table elements are not present in user-supplied
391391
-- `config`, take them from default config
392392
vim.validate({ config = { config, 'table', true } })
393-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
393+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
394394

395395
vim.validate({
396396
options = { config.options, 'table' },

lua/mini/bracketed.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ end
12861286

12871287
-- Helper data ================================================================
12881288
-- Module default config
1289-
H.default_config = MiniBracketed.config
1289+
H.default_config = vim.deepcopy(MiniBracketed.config)
12901290

12911291
H.cache = {
12921292
-- Tracking of old files for `oldfile()` (this data structure is designed to be
@@ -1340,7 +1340,7 @@ H.setup_config = function(config)
13401340
-- General idea: if some table elements are not present in user-supplied
13411341
-- `config`, take them from default config
13421342
vim.validate({ config = { config, 'table', true } })
1343-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1343+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
13441344

13451345
--stylua: ignore
13461346
vim.validate({

lua/mini/bufremove.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ end
166166

167167
-- Helper data ================================================================
168168
-- Module default config
169-
H.default_config = MiniBufremove.config
169+
H.default_config = vim.deepcopy(MiniBufremove.config)
170170

171171
-- Helper functionality =======================================================
172172
-- Settings -------------------------------------------------------------------
173173
H.setup_config = function(config)
174174
-- General idea: if some table elements are not present in user-supplied
175175
-- `config`, take them from default config
176176
vim.validate({ config = { config, 'table', true } })
177-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
177+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
178178

179179
vim.validate({
180180
set_vim_settings = { config.set_vim_settings, 'boolean' },

lua/mini/clue.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ end
10681068

10691069
-- Helper data ================================================================
10701070
-- Module default config
1071-
H.default_config = MiniClue.config
1071+
H.default_config = vim.deepcopy(MiniClue.config)
10721072

10731073
-- Namespaces
10741074
H.ns_id = {
@@ -1121,7 +1121,7 @@ H.setup_config = function(config)
11211121
-- General idea: if some table elements are not present in user-supplied
11221122
-- `config`, take them from default config
11231123
vim.validate({ config = { config, 'table', true } })
1124-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1124+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
11251125

11261126
vim.validate({
11271127
clues = { config.clues, 'table' },

lua/mini/colors.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ end
10071007

10081008
-- Helper data ================================================================
10091009
-- Module default config
1010-
H.default_config = MiniColors.config
1010+
H.default_config = vim.deepcopy(MiniColors.config)
10111011

10121012
-- Color conversion constants
10131013
H.tau = 2 * math.pi
@@ -1134,7 +1134,7 @@ H.setup_config = function(config)
11341134
-- General idea: if some table elements are not present in user-supplied
11351135
-- `config`, take them from default config
11361136
vim.validate({ config = { config, 'table', true } })
1137-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1137+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
11381138

11391139
return config
11401140
end

lua/mini/comment.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,15 @@ end
363363

364364
-- Helper data ================================================================
365365
-- Module default config
366-
H.default_config = MiniComment.config
366+
H.default_config = vim.deepcopy(MiniComment.config)
367367

368368
-- Helper functionality =======================================================
369369
-- Settings -------------------------------------------------------------------
370370
H.setup_config = function(config)
371371
-- General idea: if some table elements are not present in user-supplied
372372
-- `config`, take them from default config
373373
vim.validate({ config = { config, 'table', true } })
374-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
374+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
375375

376376
-- Validate per nesting level to produce correct error message
377377
vim.validate({

lua/mini/completion.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ MiniCompletion.default_process_items =
406406

407407
-- Helper data ================================================================
408408
-- Module default config
409-
H.default_config = MiniCompletion.config
409+
H.default_config = vim.deepcopy(MiniCompletion.config)
410410

411411
-- Track Insert mode changes
412412
H.text_changed_id = 0
@@ -464,7 +464,7 @@ H.setup_config = function(config)
464464
-- General idea: if some table elements are not present in user-supplied
465465
-- `config`, take them from default config
466466
vim.validate({ config = { config, 'table', true } })
467-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
467+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
468468

469469
-- Validate per nesting level to produce correct error message
470470
vim.validate({

lua/mini/cursorword.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ MiniCursorword.config = {
117117

118118
-- Helper data ================================================================
119119
-- Module default config
120-
H.default_config = MiniCursorword.config
120+
H.default_config = vim.deepcopy(MiniCursorword.config)
121121

122122
-- Delay timer
123123
H.timer = vim.loop.new_timer()
@@ -135,7 +135,7 @@ H.setup_config = function(config)
135135
-- General idea: if some table elements are not present in user-supplied
136136
-- `config`, take them from default config
137137
vim.validate({ config = { config, 'table', true } })
138-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
138+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
139139

140140
vim.validate({ delay = { config.delay, 'number' } })
141141

lua/mini/doc.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ end
678678

679679
-- Helper data ================================================================
680680
-- Module default config
681-
H.default_config = MiniDoc.config
681+
H.default_config = vim.deepcopy(MiniDoc.config)
682682

683683
-- Alias registry. Keys are alias name, values - single string of alias
684684
-- description with '\n' separating output lines.
@@ -721,7 +721,7 @@ H.setup_config = function(config)
721721
-- General idea: if some table elements are not present in user-supplied
722722
-- `config`, take them from default config
723723
vim.validate({ config = { config, 'table', true } })
724-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
724+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
725725

726726
-- Validate per nesting level to produce correct error message
727727
vim.validate({

lua/mini/files.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ end
10181018

10191019
-- Helper data ================================================================
10201020
-- Module default config
1021-
H.default_config = MiniFiles.config
1021+
H.default_config = vim.deepcopy(MiniFiles.config)
10221022

10231023
-- Namespaces
10241024
H.ns_id = {
@@ -1058,7 +1058,7 @@ H.setup_config = function(config)
10581058
-- General idea: if some table elements are not present in user-supplied
10591059
-- `config`, take them from default config
10601060
vim.validate({ config = { config, 'table', true } })
1061-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
1061+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
10621062

10631063
vim.validate({
10641064
content = { config.content, 'table' },

lua/mini/fuzzy.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ end
211211

212212
-- Helper data ================================================================
213213
-- Module default config
214-
H.default_config = MiniFuzzy.config
214+
H.default_config = vim.deepcopy(MiniFuzzy.config)
215215

216216
-- Helper functionality =======================================================
217217
-- Settings -------------------------------------------------------------------
218218
H.setup_config = function(config)
219219
-- General idea: if some table elements are not present in user-supplied
220220
-- `config`, take them from default config
221221
vim.validate({ config = { config, 'table', true } })
222-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
222+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
223223

224224
vim.validate({
225225
cutoff = {

lua/mini/hipatterns.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ end
538538

539539
-- Helper data ================================================================
540540
-- Module default config
541-
H.default_config = MiniHipatterns.config
541+
H.default_config = vim.deepcopy(MiniHipatterns.config)
542542

543543
-- Timers
544544
H.timer_debounce = vim.loop.new_timer()
@@ -562,7 +562,7 @@ H.setup_config = function(config)
562562
-- General idea: if some table elements are not present in user-supplied
563563
-- `config`, take them from default config
564564
vim.validate({ config = { config, 'table', true } })
565-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
565+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
566566

567567
vim.validate({
568568
highlighters = { config.highlighters, 'table' },

lua/mini/hues.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ end
438438

439439
-- Helper data ================================================================
440440
-- Module default config
441-
H.default_config = MiniHues.config
441+
H.default_config = vim.deepcopy(MiniHues.config)
442442

443443
-- Color conversion constants
444444
H.tau = 2 * math.pi
@@ -507,7 +507,7 @@ H.setup_config = function(config)
507507
-- General idea: if some table elements are not present in user-supplied
508508
-- `config`, take them from default config
509509
vim.validate({ config = { config, 'table', true } })
510-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
510+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
511511

512512
if config.background == nil or config.foreground == nil then
513513
H.error('`setup()` needs both `background` and `foreground`.')

lua/mini/indentscope.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ end
519519

520520
-- Helper data ================================================================
521521
-- Module default config
522-
H.default_config = MiniIndentscope.config
522+
H.default_config = vim.deepcopy(MiniIndentscope.config)
523523

524524
-- Namespace for drawing vertical line
525525
H.ns_id = vim.api.nvim_create_namespace('MiniIndentscope')
@@ -593,7 +593,7 @@ H.setup_config = function(config)
593593
-- General idea: if some table elements are not present in user-supplied
594594
-- `config`, take them from default config
595595
vim.validate({ config = { config, 'table', true } })
596-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
596+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
597597

598598
-- Validate per nesting level to produce correct error message
599599
vim.validate({

lua/mini/jump.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ end
254254

255255
-- Helper data ================================================================
256256
-- Module default config
257-
H.default_config = MiniJump.config
257+
H.default_config = vim.deepcopy(MiniJump.config)
258258

259259
-- Cache for various operations
260260
H.cache = {
@@ -284,7 +284,7 @@ H.setup_config = function(config)
284284
-- General idea: if some table elements are not present in user-supplied
285285
-- `config`, take them from default config
286286
vim.validate({ config = { config, 'table', true } })
287-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
287+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
288288

289289
-- Validate per nesting level to produce correct error message
290290
vim.validate({

lua/mini/jump2d.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ MiniJump2d.builtin_opts.query = user_input_opts(function() return H.input('Enter
607607

608608
-- Helper data ================================================================
609609
-- Module default config
610-
H.default_config = MiniJump2d.config
610+
H.default_config = vim.deepcopy(MiniJump2d.config)
611611

612612
-- Namespaces to be used withing module
613613
H.ns_id = {
@@ -641,7 +641,7 @@ H.setup_config = function(config)
641641
-- General idea: if some table elements are not present in user-supplied
642642
-- `config`, take them from default config
643643
vim.validate({ config = { config, 'table', true } })
644-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
644+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
645645

646646
vim.validate({
647647
spotter = { config.spotter, 'function', true },

lua/mini/map.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ end
894894

895895
-- Helper data ================================================================
896896
-- Module default config
897-
H.default_config = MiniMap.config
897+
H.default_config = vim.deepcopy(MiniMap.config)
898898

899899
-- Cache for various operations
900900
H.cache = {
@@ -980,7 +980,7 @@ H.setup_config = function(config)
980980
-- General idea: if some table elements are not present in user-supplied
981981
-- `config`, take them from default config
982982
vim.validate({ config = { config, 'table', true } })
983-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
983+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
984984

985985
vim.validate({
986986
integrations = { config.integrations, H.is_valid_config_integrations },

lua/mini/misc.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ end
501501

502502
-- Helper data ================================================================
503503
-- Module default config
504-
H.default_config = MiniMisc.config
504+
H.default_config = vim.deepcopy(MiniMisc.config)
505505

506506
-- Window identifier of current zoom (for `zoom()`)
507507
H.zoom_winid = nil
@@ -512,7 +512,7 @@ H.setup_config = function(config)
512512
-- General idea: if some table elements are not present in user-supplied
513513
-- `config`, take them from default config
514514
vim.validate({ config = { config, 'table', true } })
515-
config = vim.tbl_deep_extend('force', H.default_config, config or {})
515+
config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
516516

517517
vim.validate({
518518
make_global = {

0 commit comments

Comments
 (0)