Squashed 'users/configs/system/nvim/nvim/' content from commit e088bce2
git-subtree-dir: users/configs/system/nvim/nvim git-subtree-split: e088bce2bd90c0b5c35d13a8615a55455b96294d
This commit is contained in:
17
lua/plugins/configs/alpha.lua
Normal file
17
lua/plugins/configs/alpha.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return function(_, opts)
|
||||
require("alpha").setup(opts.config)
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
desc = "Add Alpha dashboard footer",
|
||||
once = true,
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = math.floor(stats.startuptime * 100 + 0.5) / 100
|
||||
opts.section.footer.val =
|
||||
{ " ", " ", " ", "AstroNvim loaded " .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||
opts.section.footer.opts.hl = "DashboardFooter"
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end
|
||||
7
lua/plugins/configs/cmp-dap.lua
Normal file
7
lua/plugins/configs/cmp-dap.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return function()
|
||||
require("cmp").setup.filetype({ "dap-repl", "dapui_watches", "dapui_hover" }, {
|
||||
sources = {
|
||||
{ name = "dap" },
|
||||
},
|
||||
})
|
||||
end
|
||||
4
lua/plugins/configs/guess-indent.lua
Normal file
4
lua/plugins/configs/guess-indent.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return function(_, opts)
|
||||
require("guess-indent").setup(opts)
|
||||
vim.cmd.lua { args = { "require('guess-indent').set_from_buffer('auto_cmd')" }, mods = { silent = true } }
|
||||
end
|
||||
119
lua/plugins/configs/heirline.lua
Normal file
119
lua/plugins/configs/heirline.lua
Normal file
@@ -0,0 +1,119 @@
|
||||
return function(_, opts)
|
||||
local heirline = require "heirline"
|
||||
local hl = require "astronvim.utils.status.hl"
|
||||
local C = require("astronvim.utils.status.env").fallback_colors
|
||||
local get_hlgroup = require("astronvim.utils").get_hlgroup
|
||||
|
||||
local function setup_colors()
|
||||
local Normal = get_hlgroup("Normal", { fg = C.fg, bg = C.bg })
|
||||
local Comment = get_hlgroup("Comment", { fg = C.bright_grey, bg = C.bg })
|
||||
local Error = get_hlgroup("Error", { fg = C.red, bg = C.bg })
|
||||
local StatusLine = get_hlgroup("StatusLine", { fg = C.fg, bg = C.dark_bg })
|
||||
local TabLine = get_hlgroup("TabLine", { fg = C.grey, bg = C.none })
|
||||
local TabLineFill = get_hlgroup("TabLineFill", { fg = C.fg, bg = C.dark_bg })
|
||||
local TabLineSel = get_hlgroup("TabLineSel", { fg = C.fg, bg = C.none })
|
||||
local WinBar = get_hlgroup("WinBar", { fg = C.bright_grey, bg = C.bg })
|
||||
local WinBarNC = get_hlgroup("WinBarNC", { fg = C.grey, bg = C.bg })
|
||||
local Conditional = get_hlgroup("Conditional", { fg = C.bright_purple, bg = C.dark_bg })
|
||||
local String = get_hlgroup("String", { fg = C.green, bg = C.dark_bg })
|
||||
local TypeDef = get_hlgroup("TypeDef", { fg = C.yellow, bg = C.dark_bg })
|
||||
local GitSignsAdd = get_hlgroup("GitSignsAdd", { fg = C.green, bg = C.dark_bg })
|
||||
local GitSignsChange = get_hlgroup("GitSignsChange", { fg = C.orange, bg = C.dark_bg })
|
||||
local GitSignsDelete = get_hlgroup("GitSignsDelete", { fg = C.bright_red, bg = C.dark_bg })
|
||||
local DiagnosticError = get_hlgroup("DiagnosticError", { fg = C.bright_red, bg = C.dark_bg })
|
||||
local DiagnosticWarn = get_hlgroup("DiagnosticWarn", { fg = C.orange, bg = C.dark_bg })
|
||||
local DiagnosticInfo = get_hlgroup("DiagnosticInfo", { fg = C.white, bg = C.dark_bg })
|
||||
local DiagnosticHint = get_hlgroup("DiagnosticHint", { fg = C.bright_yellow, bg = C.dark_bg })
|
||||
local HeirlineInactive = get_hlgroup("HeirlineInactive", { bg = nil }).bg
|
||||
or hl.lualine_mode("inactive", C.dark_grey)
|
||||
local HeirlineNormal = get_hlgroup("HeirlineNormal", { bg = nil }).bg or hl.lualine_mode("normal", C.blue)
|
||||
local HeirlineInsert = get_hlgroup("HeirlineInsert", { bg = nil }).bg or hl.lualine_mode("insert", C.green)
|
||||
local HeirlineVisual = get_hlgroup("HeirlineVisual", { bg = nil }).bg or hl.lualine_mode("visual", C.purple)
|
||||
local HeirlineReplace = get_hlgroup("HeirlineReplace", { bg = nil }).bg or hl.lualine_mode("replace", C.bright_red)
|
||||
local HeirlineCommand = get_hlgroup("HeirlineCommand", { bg = nil }).bg
|
||||
or hl.lualine_mode("command", C.bright_yellow)
|
||||
local HeirlineTerminal = get_hlgroup("HeirlineTerminal", { bg = nil }).bg
|
||||
or hl.lualine_mode("insert", HeirlineInsert)
|
||||
|
||||
local colors = astronvim.user_opts("heirline.colors", {
|
||||
close_fg = Error.fg,
|
||||
fg = StatusLine.fg,
|
||||
bg = StatusLine.bg,
|
||||
section_fg = StatusLine.fg,
|
||||
section_bg = StatusLine.bg,
|
||||
git_branch_fg = Conditional.fg,
|
||||
mode_fg = StatusLine.bg,
|
||||
treesitter_fg = String.fg,
|
||||
scrollbar = TypeDef.fg,
|
||||
git_added = GitSignsAdd.fg,
|
||||
git_changed = GitSignsChange.fg,
|
||||
git_removed = GitSignsDelete.fg,
|
||||
diag_ERROR = DiagnosticError.fg,
|
||||
diag_WARN = DiagnosticWarn.fg,
|
||||
diag_INFO = DiagnosticInfo.fg,
|
||||
diag_HINT = DiagnosticHint.fg,
|
||||
winbar_fg = WinBar.fg,
|
||||
winbar_bg = WinBar.bg,
|
||||
winbarnc_fg = WinBarNC.fg,
|
||||
winbarnc_bg = WinBarNC.bg,
|
||||
tabline_bg = TabLineFill.bg,
|
||||
tabline_fg = TabLineFill.bg,
|
||||
buffer_fg = Comment.fg,
|
||||
buffer_path_fg = WinBarNC.fg,
|
||||
buffer_close_fg = Comment.fg,
|
||||
buffer_bg = TabLineFill.bg,
|
||||
buffer_active_fg = Normal.fg,
|
||||
buffer_active_path_fg = WinBarNC.fg,
|
||||
buffer_active_close_fg = Error.fg,
|
||||
buffer_active_bg = Normal.bg,
|
||||
buffer_visible_fg = Normal.fg,
|
||||
buffer_visible_path_fg = WinBarNC.fg,
|
||||
buffer_visible_close_fg = Error.fg,
|
||||
buffer_visible_bg = Normal.bg,
|
||||
buffer_overflow_fg = Comment.fg,
|
||||
buffer_overflow_bg = TabLineFill.bg,
|
||||
buffer_picker_fg = Error.fg,
|
||||
tab_close_fg = Error.fg,
|
||||
tab_close_bg = TabLineFill.bg,
|
||||
tab_fg = TabLine.fg,
|
||||
tab_bg = TabLine.bg,
|
||||
tab_active_fg = TabLineSel.fg,
|
||||
tab_active_bg = TabLineSel.bg,
|
||||
inactive = HeirlineInactive,
|
||||
normal = HeirlineNormal,
|
||||
insert = HeirlineInsert,
|
||||
visual = HeirlineVisual,
|
||||
replace = HeirlineReplace,
|
||||
command = HeirlineCommand,
|
||||
terminal = HeirlineTerminal,
|
||||
})
|
||||
|
||||
for _, section in ipairs {
|
||||
"git_branch",
|
||||
"file_info",
|
||||
"git_diff",
|
||||
"diagnostics",
|
||||
"lsp",
|
||||
"macro_recording",
|
||||
"mode",
|
||||
"cmd_info",
|
||||
"treesitter",
|
||||
"nav",
|
||||
} do
|
||||
if not colors[section .. "_bg"] then colors[section .. "_bg"] = colors["section_bg"] end
|
||||
if not colors[section .. "_fg"] then colors[section .. "_fg"] = colors["section_fg"] end
|
||||
end
|
||||
return colors
|
||||
end
|
||||
|
||||
heirline.load_colors(setup_colors())
|
||||
heirline.setup(opts)
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("Heirline", { clear = true })
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "AstroColorScheme",
|
||||
group = augroup,
|
||||
desc = "Refresh heirline colors",
|
||||
callback = function() require("heirline.utils").on_colorscheme(setup_colors()) end,
|
||||
})
|
||||
end
|
||||
56
lua/plugins/configs/lspconfig.lua
Normal file
56
lua/plugins/configs/lspconfig.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
return function(_, _)
|
||||
local lsp = require "astronvim.utils.lsp"
|
||||
local utils = require "astronvim.utils"
|
||||
local get_icon = utils.get_icon
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = get_icon "DiagnosticError", texthl = "DiagnosticSignError" },
|
||||
{ name = "DiagnosticSignWarn", text = get_icon "DiagnosticWarn", texthl = "DiagnosticSignWarn" },
|
||||
{ name = "DiagnosticSignHint", text = get_icon "DiagnosticHint", texthl = "DiagnosticSignHint" },
|
||||
{ name = "DiagnosticSignInfo", text = get_icon "DiagnosticInfo", texthl = "DiagnosticSignInfo" },
|
||||
{ name = "DapStopped", text = get_icon "DapStopped", texthl = "DiagnosticWarn" },
|
||||
{ name = "DapBreakpoint", text = get_icon "DapBreakpoint", texthl = "DiagnosticInfo" },
|
||||
{ name = "DapBreakpointRejected", text = get_icon "DapBreakpointRejected", texthl = "DiagnosticError" },
|
||||
{ name = "DapBreakpointCondition", text = get_icon "DapBreakpointCondition", texthl = "DiagnosticInfo" },
|
||||
{ name = "DapLogPoint", text = get_icon "DapLogPoint", texthl = "DiagnosticInfo" },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, sign)
|
||||
end
|
||||
lsp.setup_diagnostics(signs)
|
||||
|
||||
local orig_handler = vim.lsp.handlers["$/progress"]
|
||||
vim.lsp.handlers["$/progress"] = function(_, msg, info)
|
||||
local progress, id = astronvim.lsp.progress, ("%s.%s"):format(info.client_id, msg.token)
|
||||
progress[id] = progress[id] and utils.extend_tbl(progress[id], msg.value) or msg.value
|
||||
if progress[id].kind == "end" then
|
||||
vim.defer_fn(function()
|
||||
progress[id] = nil
|
||||
utils.event "LspProgress"
|
||||
end, 100)
|
||||
end
|
||||
utils.event "LspProgress"
|
||||
orig_handler(_, msg, info)
|
||||
end
|
||||
|
||||
if vim.g.lsp_handlers_enabled then
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded", silent = true })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded", silent = true })
|
||||
end
|
||||
local setup_servers = function()
|
||||
vim.tbl_map(require("astronvim.utils.lsp").setup, astronvim.user_opts "lsp.servers")
|
||||
vim.api.nvim_exec_autocmds("FileType", {})
|
||||
require("astronvim.utils").event "LspSetup"
|
||||
end
|
||||
if require("astronvim.utils").is_available "mason-lspconfig.nvim" then
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
desc = "set up LSP servers after mason-lspconfig",
|
||||
pattern = "AstroMasonLspSetup",
|
||||
once = true,
|
||||
callback = setup_servers,
|
||||
})
|
||||
else
|
||||
setup_servers()
|
||||
end
|
||||
end
|
||||
1
lua/plugins/configs/lspkind.lua
Normal file
1
lua/plugins/configs/lspkind.lua
Normal file
@@ -0,0 +1 @@
|
||||
return function(_, opts) require("lspkind").init(opts) end
|
||||
4
lua/plugins/configs/luasnip.lua
Normal file
4
lua/plugins/configs/luasnip.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return function(_, opts)
|
||||
if opts then require("luasnip").config.setup(opts) end
|
||||
vim.tbl_map(function(type) require("luasnip.loaders.from_" .. type).lazy_load() end, { "vscode", "snipmate", "lua" })
|
||||
end
|
||||
4
lua/plugins/configs/mason-lspconfig.lua
Normal file
4
lua/plugins/configs/mason-lspconfig.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return function(_, opts)
|
||||
require("mason-lspconfig").setup(opts)
|
||||
require("astronvim.utils").event "MasonLspSetup"
|
||||
end
|
||||
5
lua/plugins/configs/mason-null-ls.lua
Normal file
5
lua/plugins/configs/mason-null-ls.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- TODO: REMOVE THIS UNNECESSARY FILE
|
||||
return function(_, opts)
|
||||
local mason_null_ls = require "mason-null-ls"
|
||||
mason_null_ls.setup(opts)
|
||||
end
|
||||
5
lua/plugins/configs/mason-nvim-dap.lua
Normal file
5
lua/plugins/configs/mason-nvim-dap.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- TODO: remove unnecessary file in AstroNvim v4
|
||||
return function(_, opts)
|
||||
local mason_nvim_dap = require "mason-nvim-dap"
|
||||
mason_nvim_dap.setup(opts)
|
||||
end
|
||||
26
lua/plugins/configs/mason.lua
Normal file
26
lua/plugins/configs/mason.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
return function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
|
||||
-- TODO: AstroNvim v4: change these auto command names to not conflict with core Mason commands
|
||||
local cmd = vim.api.nvim_create_user_command
|
||||
cmd("MasonUpdate", function(options) require("astronvim.utils.mason").update(options.fargs) end, {
|
||||
nargs = "*",
|
||||
desc = "Update Mason Package",
|
||||
complete = function(arg_lead)
|
||||
local _ = require "mason-core.functional"
|
||||
return _.sort_by(
|
||||
_.identity,
|
||||
_.filter(_.starts_with(arg_lead), require("mason-registry").get_installed_package_names())
|
||||
)
|
||||
end,
|
||||
})
|
||||
cmd(
|
||||
"MasonUpdateAll",
|
||||
function() require("astronvim.utils.mason").update_all() end,
|
||||
{ desc = "Update Mason Packages" }
|
||||
)
|
||||
|
||||
for _, plugin in ipairs { "mason-lspconfig", "mason-null-ls", "mason-nvim-dap" } do
|
||||
pcall(require, plugin)
|
||||
end
|
||||
end
|
||||
5
lua/plugins/configs/notify.lua
Normal file
5
lua/plugins/configs/notify.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return function(_, opts)
|
||||
local notify = require "notify"
|
||||
notify.setup(opts)
|
||||
vim.notify = notify
|
||||
end
|
||||
10
lua/plugins/configs/nvim-autopairs.lua
Normal file
10
lua/plugins/configs/nvim-autopairs.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return function(_, opts)
|
||||
local npairs = require "nvim-autopairs"
|
||||
npairs.setup(opts)
|
||||
|
||||
if not vim.g.autopairs_enabled then npairs.disable() end
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if cmp_status_ok then
|
||||
cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done { tex = false })
|
||||
end
|
||||
end
|
||||
7
lua/plugins/configs/nvim-dap-ui.lua
Normal file
7
lua/plugins/configs/nvim-dap-ui.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return function(_, opts)
|
||||
local dap, dapui = require "dap", require "dapui"
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end
|
||||
dapui.setup(opts)
|
||||
end
|
||||
1
lua/plugins/configs/nvim-treesitter.lua
Normal file
1
lua/plugins/configs/nvim-treesitter.lua
Normal file
@@ -0,0 +1 @@
|
||||
return function(_, opts) require("nvim-treesitter.configs").setup(opts) end
|
||||
5
lua/plugins/configs/nvim-web-devicons.lua
Normal file
5
lua/plugins/configs/nvim-web-devicons.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- TODO: remove unnecessary file in AstroNvim v4
|
||||
return function(_, opts)
|
||||
require("nvim-web-devicons").set_default_icon(require("astronvim.utils").get_icon "DefaultFile", "#6d8086", "66")
|
||||
require("nvim-web-devicons").set_icon(opts)
|
||||
end
|
||||
9
lua/plugins/configs/telescope.lua
Normal file
9
lua/plugins/configs/telescope.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return function(_, opts)
|
||||
local telescope = require "telescope"
|
||||
telescope.setup(opts)
|
||||
local utils = require "astronvim.utils"
|
||||
local conditional_func = utils.conditional_func
|
||||
conditional_func(telescope.load_extension, pcall(require, "notify"), "notify")
|
||||
conditional_func(telescope.load_extension, pcall(require, "aerial"), "aerial")
|
||||
conditional_func(telescope.load_extension, utils.is_available "telescope-fzf-native.nvim", "fzf")
|
||||
end
|
||||
4
lua/plugins/configs/which-key.lua
Normal file
4
lua/plugins/configs/which-key.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return function(_, opts)
|
||||
require("which-key").setup(opts)
|
||||
require("astronvim.utils").which_key_register()
|
||||
end
|
||||
Reference in New Issue
Block a user