nvim: use opts
and config
consistently for all plugins
This commit is contained in:
parent
965173484f
commit
8dc1dd324a
10 changed files with 133 additions and 145 deletions
|
@ -37,12 +37,14 @@ return {
|
|||
-- stylua: ignore end
|
||||
},
|
||||
|
||||
opts = function(_, opts)
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
-- This really does need to be a function, because we need to defer requiring
|
||||
-- the `gitlinker.hosts` module until after the plugin is loaded.
|
||||
opts = function()
|
||||
return {
|
||||
mappings = nil, -- I'm defining my own mappings above.
|
||||
callbacks = {
|
||||
["git.schauenburg.me"] = require("gitlinker.hosts").get_gitea_type_url,
|
||||
},
|
||||
})
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ return {
|
|||
|
||||
ft = "markdown",
|
||||
|
||||
config = function()
|
||||
opts = function()
|
||||
-- These work well with gruvbox.
|
||||
vim.cmd([[highlight Headline1 guibg=#161613]])
|
||||
vim.cmd([[highlight Headline2 guibg=#191915]])
|
||||
|
@ -16,7 +16,7 @@ return {
|
|||
vim.cmd([[highlight Quote guifg=#076678]])
|
||||
vim.cmd([[highlight Dash guifg=#d5c4a1]])
|
||||
|
||||
require("headlines").setup {
|
||||
return {
|
||||
markdown = {
|
||||
headline_highlights = {
|
||||
"Headline1",
|
||||
|
|
|
@ -14,15 +14,14 @@ return {
|
|||
|
||||
keys = {
|
||||
-- stylua: ignore start
|
||||
{ "<leader>si", "<cmd>IBLToggle<cr>", desc = ui.Toggle.." toggle indent lines" },
|
||||
{ "<leader>so", "<cmd>IBLToggleScope<cr>", desc = ui.Toggle.." toggle indent line scope" },
|
||||
{ "<leader>si", "<cmd>IBLToggle<cr>", desc = ui.Toggle.." toggle [i]ndent lines" },
|
||||
{ "<leader>so", "<cmd>IBLToggleScope<cr>", desc = ui.Toggle.." toggle indent line sc[o]pe" },
|
||||
-- stylua: ignore end
|
||||
},
|
||||
|
||||
main = "ibl",
|
||||
|
||||
opts = function(_, opts)
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
opts = {
|
||||
enabled = false,
|
||||
indent = { char = ui.LineLeft },
|
||||
scope = {
|
||||
|
@ -31,6 +30,5 @@ return {
|
|||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -19,20 +19,18 @@ local lsp_handlers = function()
|
|||
}
|
||||
end
|
||||
|
||||
local lsp_on_attach = function( --[[client]]_, buffer)
|
||||
local map = vim.keymap.set
|
||||
local opts = { buffer = buffer }
|
||||
local buf = vim.lsp.buf
|
||||
local lsp_on_attach = function(--[[client]]_, buffer)
|
||||
local map, opts = vim.keymap.set, { buffer = buffer }
|
||||
-- stylua: ignore start
|
||||
map("n", "<localleader>c", buf.code_action, opts)
|
||||
map("n", "<localleader>f", buf.format, opts)
|
||||
map("n", "gd", buf.definition, opts)
|
||||
map("n", "gD", buf.declaration, opts)
|
||||
map("n", "gi", buf.implementation, opts)
|
||||
map("n", "grr", buf.rename, opts)
|
||||
map("n", "gt", buf.type_definition, opts)
|
||||
map("n", "K", buf.hover, opts)
|
||||
map("i", "<c-l>", buf.signature_help, opts)
|
||||
map("n", "<localleader>c", vim.lsp.buf.code_action, opts)
|
||||
map("n", "<localleader>f", vim.lsp.buf.format, opts)
|
||||
map("n", "gd", vim.lsp.buf.definition, opts)
|
||||
map("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
map("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
map("n", "grr", vim.lsp.buf.rename, opts)
|
||||
map("n", "gt", vim.lsp.buf.type_definition, opts)
|
||||
map("n", "K", vim.lsp.buf.hover, opts)
|
||||
map("i", "<c-l>", vim.lsp.buf.signature_help, opts)
|
||||
-- stylua: ignore end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ return {
|
|||
{ "<leader>gs", "<cmd>Neogit<cr>", desc = ui.Git .. " [s]tatus (Neogit)" },
|
||||
},
|
||||
|
||||
opts = function(_, opts)
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
opts = {
|
||||
commit_editor = { kind = "tab" },
|
||||
disable_hint = true,
|
||||
signs = {
|
||||
|
@ -35,6 +34,5 @@ return {
|
|||
["="] = "Toggle",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@ return {
|
|||
|
||||
lazy = false,
|
||||
|
||||
opts = function(_, opts)
|
||||
config = function()
|
||||
local notify = require("notify")
|
||||
local icons = require("fschauen.util.icons")
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
|
||||
notify.setup {
|
||||
icons = {
|
||||
ERROR = icons.diagnostics_bold.Error,
|
||||
WARN = icons.diagnostics_bold.Warn,
|
||||
|
@ -48,12 +50,8 @@ return {
|
|||
time_formats = {
|
||||
notification_history = "%F %T │ ",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
config = function(_, opts)
|
||||
local notify = require("notify")
|
||||
notify.setup(opts)
|
||||
vim.notify = notify
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ local on_attach = function(buffer)
|
|||
-- stylua: ignore end
|
||||
end
|
||||
|
||||
local icon = require("fschauen.util.icons").ui.FileTree
|
||||
local icons = require("fschauen.util.icons")
|
||||
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
|
@ -31,14 +31,12 @@ return {
|
|||
|
||||
keys = {
|
||||
-- stylua: ignore start
|
||||
{ "<leader>tt", "<cmd>NvimTreeToggle<cr>", desc = icon.." [t]oggle [t]ree" },
|
||||
{ "<leader>tf", "<cmd>NvimTreeFindFile<cr>", desc = icon.." Open [t]ree to current [f]ile " },
|
||||
{ "<leader>tt", "<cmd>NvimTreeToggle<cr>", desc = icons.ui.FileTree.." [t]oggle [t]ree" },
|
||||
{ "<leader>tf", "<cmd>NvimTreeFindFile<cr>", desc = icons.ui.FileTree.." Open [t]ree to current [f]ile " },
|
||||
-- stylua: ignore end
|
||||
},
|
||||
|
||||
opts = function( --[[plugin]]_, opts)
|
||||
local icons = require("fschauen.util.icons")
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
opts = {
|
||||
disable_netrw = true, -- replace netrw with nvim-tree
|
||||
hijack_cursor = true, -- keep the cursor on begin of the filename
|
||||
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
|
||||
|
@ -88,6 +86,5 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ return {
|
|||
-- stylua: ignore end
|
||||
},
|
||||
|
||||
opts = function(_, opts)
|
||||
opts = function()
|
||||
local actions = require("telescope.actions")
|
||||
local layout = require("telescope.actions.layout")
|
||||
local state = require("telescope.actions.state")
|
||||
|
@ -135,7 +135,7 @@ return {
|
|||
["<c-l>"] = actions.smart_send_to_loclist + actions.open_loclist,
|
||||
}
|
||||
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
return {
|
||||
defaults = {
|
||||
mappings = { i = mappings, n = mappings },
|
||||
|
||||
|
@ -170,7 +170,7 @@ return {
|
|||
colorscheme = { theme = "dropdown" },
|
||||
spell_suggest = { theme = "cursor" },
|
||||
},
|
||||
})
|
||||
}
|
||||
end,
|
||||
|
||||
config = function(_, opts)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local ui = require("fschauen.util.icons").ui
|
||||
|
||||
local helper = require("fschauen.plugins.telescope").keymap_helper
|
||||
local lhs, desc = helper.lhs, helper.description
|
||||
|
||||
|
@ -15,17 +17,15 @@ return {
|
|||
{ lhs("t"), "<cmd>TodoTelescope<cr>", desc = desc("[t]odos") },
|
||||
},
|
||||
|
||||
opts = function(_, opts)
|
||||
local icons = require("fschauen.util.icons")
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
opts = {
|
||||
keywords = {
|
||||
TODO = { icon = icons.ui.Checkbox },
|
||||
FIX = { icon = icons.ui.Bug },
|
||||
HACK = { icon = icons.ui.Fire },
|
||||
WARN = { icon = icons.ui.Warning },
|
||||
PERF = { icon = icons.ui.Gauge },
|
||||
NOTE = { icon = icons.ui.Note },
|
||||
TEST = { icon = icons.ui.TestTube },
|
||||
TODO = { icon = ui.Checkbox },
|
||||
FIX = { icon = ui.Bug },
|
||||
HACK = { icon = ui.Fire },
|
||||
WARN = { icon = ui.Warning },
|
||||
PERF = { icon = ui.Gauge },
|
||||
NOTE = { icon = ui.Note },
|
||||
TEST = { icon = ui.TestTube },
|
||||
},
|
||||
gui_style = { fg = "bold" },
|
||||
highlight = {
|
||||
|
@ -34,6 +34,5 @@ return {
|
|||
keyword = "wide_fg",
|
||||
after = "",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -17,9 +17,7 @@ return {
|
|||
{ "<leader>sc", toggle_colorcolumn, desc = ui.Toggle .. " toggle virtual colunn" },
|
||||
},
|
||||
|
||||
opts = function(_, opts)
|
||||
return vim.tbl_deep_extend("force", opts or {}, {
|
||||
opts = {
|
||||
char = ui.LineMiddle,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue