vim: make sure not to blow up on nil opts

This commit is contained in:
Fernando Schauenburg 2024-02-19 02:04:09 +01:00
parent a15e582567
commit 36ceb2c15c
9 changed files with 11 additions and 11 deletions

View file

@ -33,7 +33,7 @@ M.keys = {
{ 'g<c-x>', dial_cmd('dec_gvisual', 'gv'), expr = true, desc = ' Decrement', mode = 'v' }, { 'g<c-x>', dial_cmd('dec_gvisual', 'gv'), expr = true, desc = ' Decrement', mode = 'v' },
} }
M.config = function() M.config = function( --[[plugin]] _, --[[opts]] _)
local augend = require('dial.augend') local augend = require('dial.augend')
require('dial.config').augends:register_group { require('dial.config').augends:register_group {
default = { default = {

View file

@ -27,7 +27,7 @@ M.keys = {
} }
M.opts = function(--[[plugin]]_, opts) M.opts = function(--[[plugin]]_, opts)
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
mappings = nil, -- I'm defining my own mappings above. mappings = nil, -- I'm defining my own mappings above.
callbacks = { callbacks = {
['git.schauenburg.me'] = require('gitlinker.hosts').get_gitea_type_url, ['git.schauenburg.me'] = require('gitlinker.hosts').get_gitea_type_url,

View file

@ -20,7 +20,7 @@ M.main = 'ibl'
M.opts = function(--[[plugin]]_, opts) M.opts = function(--[[plugin]]_, opts)
local icons = require('fschauen.util.icons') local icons = require('fschauen.util.icons')
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
enabled = false, enabled = false,
indent = { indent = {
char = icons.ui.LineLeft, char = icons.ui.LineLeft,

View file

@ -10,7 +10,7 @@ M.keys = {
M.opts = function(--[[plugin]]_, opts) M.opts = function(--[[plugin]]_, opts)
local icons = require('fschauen.util.icons') local icons = require('fschauen.util.icons')
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
disable_hint = true, disable_hint = true,
signs = { signs = {
section = { icons.ui.Folder, icons.ui.EmptyFolderOpen }, section = { icons.ui.Folder, icons.ui.EmptyFolderOpen },

View file

@ -25,7 +25,7 @@ M.lazy = false
M.opts = function(--[[plugin]]_, opts) M.opts = function(--[[plugin]]_, opts)
local icons = require('fschauen.util.icons') local icons = require('fschauen.util.icons')
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
icons = { icons = {
ERROR = icons.diagnostics_bold.Error, ERROR = icons.diagnostics_bold.Error,
WARN = icons.diagnostics_bold.Warn, WARN = icons.diagnostics_bold.Warn,

View file

@ -11,7 +11,7 @@ M.keys = {
M.opts = function(--[[plugin]]_, opts) M.opts = function(--[[plugin]]_, opts)
local icons = require('fschauen.util.icons') local icons = require('fschauen.util.icons')
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
disable_netrw = true, -- replace netrw with nvim-tree disable_netrw = true, -- replace netrw with nvim-tree
hijack_cursor = true, -- keep the cursor on begin of the filename hijack_cursor = true, -- keep the cursor on begin of the filename
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree

View file

@ -126,7 +126,7 @@ M.opts = function(--[[plugin]]_, opts)
['<c-b>'] = trouble.smart_open_with_trouble, ['<c-b>'] = trouble.smart_open_with_trouble,
} }
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
defaults = { defaults = {
mappings = { i = mappings, n = mappings }, mappings = { i = mappings, n = mappings },

View file

@ -16,7 +16,7 @@ M.keys = {
M.opts = function(--[[plugin]]_, opts) M.opts = function(--[[plugin]]_, opts)
local icons = require('fschauen.util.icons') local icons = require('fschauen.util.icons')
return vim.tbl_deep_extend('force', opts, { return vim.tbl_deep_extend('force', opts or {}, {
keywords = { keywords = {
TODO = { icon = icons.ui.Checkbox }, TODO = { icon = icons.ui.Checkbox },
FIX = { icon = icons.ui.Bug }, FIX = { icon = icons.ui.Bug },

View file

@ -16,10 +16,10 @@ M.keys = {
{ '<leader>sc', toggle_colorcolumn, desc = toggle .. 'virtual colunn' }, { '<leader>sc', toggle_colorcolumn, desc = toggle .. 'virtual colunn' },
} }
M.config = function(--[[plugin]]_, --[[opts]]_) M.opts = function(--[[plugin]]_, opts)
require('virt-column').setup { return vim.tbl_deep_extend('force', opts or {}, {
char = require('fschauen.util.icons').ui.LineMiddle, char = require('fschauen.util.icons').ui.LineMiddle,
} })
end end
return M return M