Squashed 'users/configs/system/nvim/nvim/' content from commit e088bce

git-subtree-dir: users/configs/system/nvim/nvim
git-subtree-split: e088bce2bd90c0b5c35d13a8615a55455b96294d
This commit is contained in:
2023-06-25 21:23:24 +01:00
commit 2e3cb758da
96 changed files with 7965 additions and 0 deletions

38
lua/plugins/alpha.lua Normal file
View File

@@ -0,0 +1,38 @@
return {
"goolord/alpha-nvim",
cmd = "Alpha",
opts = function()
local dashboard = require "alpha.themes.dashboard"
dashboard.section.header.val = {
" █████ ███████ ████████ ██████ ██████",
"██ ██ ██ ██ ██ ██ ██ ██",
"███████ ███████ ██ ██████ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████",
" ",
" ███ ██ ██ ██ ██ ███ ███",
" ████ ██ ██ ██ ██ ████ ████",
" ██ ██ ██ ██ ██ ██ ██ ████ ██",
" ██ ██ ██ ██ ██ ██ ██ ██ ██",
" ██ ████ ████ ██ ██ ██",
}
dashboard.section.header.opts.hl = "DashboardHeader"
local button = require("astronvim.utils").alpha_button
local get_icon = require("astronvim.utils").get_icon
dashboard.section.buttons.val = {
button("LDR n ", get_icon("FileNew", 2, true) .. "New File "),
button("LDR f f", get_icon("Search", 2, true) .. "Find File "),
button("LDR f o", get_icon("DefaultFile", 2, true) .. "Recents "),
button("LDR f w", get_icon("WordFile", 2, true) .. "Find Word "),
button("LDR f '", get_icon("Bookmarks", 2, true) .. "Bookmarks "),
button("LDR S l", get_icon("Refresh", 2, true) .. "Last Session "),
}
dashboard.config.layout[1].val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }
dashboard.config.layout[3].val = 5
dashboard.config.opts.noautocmd = true
return dashboard
end,
config = require "plugins.configs.alpha",
}

112
lua/plugins/cmp.lua Normal file
View File

@@ -0,0 +1,112 @@
return {
{
"L3MON4D3/LuaSnip",
build = vim.fn.has "win32" ~= 0
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp"
or nil,
dependencies = { "rafamadriz/friendly-snippets" },
opts = { store_selection_keys = "<C-x>" },
config = require "plugins.configs.luasnip",
},
{
"hrsh7th/nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
},
event = "InsertEnter",
opts = function()
local cmp = require "cmp"
local snip_status_ok, luasnip = pcall(require, "luasnip")
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
local utils = require "astronvim.utils"
if not snip_status_ok then return end
local border_opts = {
border = "single",
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None",
}
local function has_words_before()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
end
return {
enabled = function()
local dap_prompt = utils.is_available "cmp-dap" -- add interoperability with cmp-dap
and vim.tbl_contains(
{ "dap-repl", "dapui_watches", "dapui_hover" },
vim.api.nvim_get_option_value("filetype", { buf = 0 })
)
if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then return false end
return vim.g.cmp_enabled
end,
preselect = cmp.PreselectMode.None,
formatting = {
fields = { "kind", "abbr", "menu" },
format = lspkind_status_ok and lspkind.cmp_format(utils.plugin_opts "lspkind.nvim") or nil,
},
snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end,
},
duplicates = {
nvim_lsp = 1,
luasnip = 1,
cmp_tabnine = 1,
buffer = 1,
path = 1,
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
window = {
completion = cmp.config.window.bordered(border_opts),
documentation = cmp.config.window.bordered(border_opts),
},
mapping = {
["<Up>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select },
["<Down>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select },
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable,
["<C-e>"] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() },
["<CR>"] = cmp.mapping.confirm { select = false },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = cmp.config.sources {
{ name = "nvim_lsp", priority = 1000 },
{ name = "luasnip", priority = 750 },
{ name = "buffer", priority = 500 },
{ name = "path", priority = 250 },
},
}
end,
},
}

View 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

View File

@@ -0,0 +1,7 @@
return function()
require("cmp").setup.filetype({ "dap-repl", "dapui_watches", "dapui_hover" }, {
sources = {
{ name = "dap" },
},
})
end

View 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

View 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

View 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

View File

@@ -0,0 +1 @@
return function(_, opts) require("lspkind").init(opts) end

View 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

View File

@@ -0,0 +1,4 @@
return function(_, opts)
require("mason-lspconfig").setup(opts)
require("astronvim.utils").event "MasonLspSetup"
end

View 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

View 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

View 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

View File

@@ -0,0 +1,5 @@
return function(_, opts)
local notify = require "notify"
notify.setup(opts)
vim.notify = notify
end

View 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

View 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

View File

@@ -0,0 +1 @@
return function(_, opts) require("nvim-treesitter.configs").setup(opts) end

View 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

View 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

View File

@@ -0,0 +1,4 @@
return function(_, opts)
require("which-key").setup(opts)
require("astronvim.utils").which_key_register()
end

127
lua/plugins/core.lua Normal file
View File

@@ -0,0 +1,127 @@
return {
"nvim-lua/plenary.nvim",
{ "AstroNvim/astrotheme", opts = { plugins = { ["dashboard-nvim"] = true } } },
{ "famiu/bufdelete.nvim", cmd = { "Bdelete", "Bwipeout" } },
{ "max397574/better-escape.nvim", event = "InsertCharPre", opts = { timeout = 300 } },
{ "NMAC427/guess-indent.nvim", event = "User AstroFile", config = require "plugins.configs.guess-indent" },
{ -- TODO: REMOVE neovim-session-manager with AstroNvim v4
"Shatur/neovim-session-manager",
event = "BufWritePost",
cmd = "SessionManager",
enabled = vim.g.resession_enabled ~= true,
},
{
"stevearc/resession.nvim",
enabled = vim.g.resession_enabled == true,
opts = {
buf_filter = function(bufnr) return require("astronvim.utils.buffer").is_restorable(bufnr) end,
tab_buf_filter = function(tabpage, bufnr) return vim.tbl_contains(vim.t[tabpage].bufs, bufnr) end,
extensions = { astronvim = {} },
},
},
{
"s1n7ax/nvim-window-picker",
name = "window-picker",
opts = {
picker_config = {
statusline_winbar_picker = {
use_winbar = "smart",
},
},
},
},
{
"mrjones2014/smart-splits.nvim",
opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } },
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {
check_ts = true,
ts_config = { java = false },
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0,
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
},
config = require "plugins.configs.nvim-autopairs",
},
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
icons = { group = vim.g.icons_enabled and "" or "+", separator = "" },
disable = { filetypes = { "TelescopePrompt" } },
},
config = require "plugins.configs.which-key",
},
{
"kevinhwang91/nvim-ufo",
event = { "User AstroFile", "InsertEnter" },
dependencies = { "kevinhwang91/promise-async" },
opts = {
preview = {
mappings = {
scrollB = "<C-b>",
scrollF = "<C-f>",
scrollU = "<C-u>",
scrollD = "<C-d>",
},
},
provider_selector = function(_, filetype, buftype)
local function handleFallbackException(bufnr, err, providerName)
if type(err) == "string" and err:match "UfoFallbackException" then
return require("ufo").getFolds(bufnr, providerName)
else
return require("promise").reject(err)
end
end
return (filetype == "" or buftype == "nofile") and "indent" -- only use indent until a file is opened
or function(bufnr)
return require("ufo")
.getFolds(bufnr, "lsp")
:catch(function(err) return handleFallbackException(bufnr, err, "treesitter") end)
:catch(function(err) return handleFallbackException(bufnr, err, "indent") end)
end
end,
},
},
{
"numToStr/Comment.nvim",
keys = {
{ "gc", mode = { "n", "v" }, desc = "Comment toggle linewise" },
{ "gb", mode = { "n", "v" }, desc = "Comment toggle blockwise" },
},
opts = function()
local commentstring_avail, commentstring = pcall(require, "ts_context_commentstring.integrations.comment_nvim")
return commentstring_avail and commentstring and { pre_hook = commentstring.create_pre_hook() } or {}
end,
},
{
"akinsho/toggleterm.nvim",
cmd = { "ToggleTerm", "TermExec" },
opts = {
size = 10,
on_create = function()
vim.opt.foldcolumn = "0"
vim.opt.signcolumn = "no"
end,
open_mapping = [[<F7>]],
shading_factor = 2,
direction = "float",
float_opts = {
border = "curved",
highlights = { border = "Normal", background = "Normal" },
},
},
},
}

23
lua/plugins/dap.lua Normal file
View File

@@ -0,0 +1,23 @@
return {
"mfussenegger/nvim-dap",
enabled = vim.fn.has "win32" == 0,
dependencies = {
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = { "nvim-dap" },
cmd = { "DapInstall", "DapUninstall" },
opts = { handlers = {} },
},
{
"rcarriga/nvim-dap-ui",
opts = { floating = { border = "rounded" } },
config = require "plugins.configs.nvim-dap-ui",
},
{
"rcarriga/cmp-dap",
dependencies = { "nvim-cmp" },
config = require "plugins.configs.cmp-dap",
},
},
event = "User AstroFile",
}

16
lua/plugins/git.lua Normal file
View File

@@ -0,0 +1,16 @@
local get_icon = require("astronvim.utils").get_icon
return {
"lewis6991/gitsigns.nvim",
enabled = vim.fn.executable "git" == 1,
event = "User AstroGitFile",
opts = {
signs = {
add = { text = get_icon "GitSign" },
change = { text = get_icon "GitSign" },
delete = { text = get_icon "GitSign" },
topdelete = { text = get_icon "GitSign" },
changedelete = { text = get_icon "GitSign" },
untracked = { text = get_icon "GitSign" },
},
},
}

87
lua/plugins/heirline.lua Normal file
View File

@@ -0,0 +1,87 @@
return {
"rebelot/heirline.nvim",
event = "BufEnter",
opts = function()
local status = require "astronvim.utils.status"
return {
opts = {
disable_winbar_cb = function(args)
return not require("astronvim.utils.buffer").is_valid(args.buf)
or status.condition.buffer_matches({
buftype = { "terminal", "prompt", "nofile", "help", "quickfix" },
filetype = { "NvimTree", "neo%-tree", "dashboard", "Outline", "aerial" },
}, args.buf)
end,
},
statusline = { -- statusline
hl = { fg = "fg", bg = "bg" },
status.component.mode(),
status.component.git_branch(),
status.component.file_info { filetype = {}, filename = false, file_modified = false },
status.component.git_diff(),
status.component.diagnostics(),
status.component.fill(),
status.component.cmd_info(),
status.component.fill(),
status.component.lsp(),
status.component.treesitter(),
status.component.nav(),
status.component.mode { surround = { separator = "right" } },
},
winbar = { -- winbar
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
fallthrough = false,
{
condition = function() return not status.condition.is_active() end,
status.component.separated_path(),
status.component.file_info {
file_icon = { hl = status.hl.file_icon "winbar", padding = { left = 0 } },
file_modified = false,
file_read_only = false,
hl = status.hl.get_attributes("winbarnc", true),
surround = false,
update = "BufEnter",
},
},
status.component.breadcrumbs { hl = status.hl.get_attributes("winbar", true) },
},
tabline = { -- bufferline
{ -- file tree padding
condition = function(self)
self.winid = vim.api.nvim_tabpage_list_wins(0)[1]
return status.condition.buffer_matches(
{ filetype = { "aerial", "dapui_.", "neo%-tree", "NvimTree" } },
vim.api.nvim_win_get_buf(self.winid)
)
end,
provider = function(self) return string.rep(" ", vim.api.nvim_win_get_width(self.winid) + 1) end,
hl = { bg = "tabline_bg" },
},
status.heirline.make_buflist(status.component.tabline_file_info()), -- component for each buffer tab
status.component.fill { hl = { bg = "tabline_bg" } }, -- fill the rest of the tabline with background color
{ -- tab list
condition = function() return #vim.api.nvim_list_tabpages() >= 2 end, -- only show tabs if there are more than one
status.heirline.make_tablist { -- component for each tab
provider = status.provider.tabnr(),
hl = function(self) return status.hl.get_attributes(status.heirline.tab_type(self, "tab"), true) end,
},
{ -- close button for current tab
provider = status.provider.close_button { kind = "TabClose", padding = { left = 1, right = 1 } },
hl = status.hl.get_attributes("tab_close", true),
on_click = {
callback = function() require("astronvim.utils.buffer").close_tab() end,
name = "heirline_tabline_close_tab_callback",
},
},
},
},
statuscolumn = vim.fn.has "nvim-0.9" == 1 and {
status.component.foldcolumn(),
status.component.fill(),
status.component.numbercolumn(),
status.component.signcolumn(),
} or nil,
}
end,
config = require "plugins.configs.heirline",
}

93
lua/plugins/lsp.lua Normal file
View File

@@ -0,0 +1,93 @@
return {
"b0o/SchemaStore.nvim",
{
"folke/neodev.nvim",
opts = {
override = function(root_dir, library)
for _, astronvim_config in ipairs(astronvim.supported_configs) do
if root_dir:match(astronvim_config) then
library.plugins = true
break
end
end
vim.b.neodev_enabled = library.enabled
end,
},
},
{
"neovim/nvim-lspconfig",
dependencies = {
{
"folke/neoconf.nvim",
cmd = "Neoconf",
opts = function()
local global_settings, file_found
local _, depth = vim.fn.stdpath("config"):gsub("/", "")
for _, dir in ipairs(astronvim.supported_configs) do
dir = dir .. "/lua/user"
if vim.fn.isdirectory(dir) == 1 then
local path = dir .. "/neoconf.json"
if vim.fn.filereadable(path) == 1 then
file_found = true
global_settings = path
elseif not file_found then
global_settings = path
end
end
end
return { global_settings = global_settings and string.rep("../", depth):sub(1, -2) .. global_settings }
end,
},
{
"williamboman/mason-lspconfig.nvim",
cmd = { "LspInstall", "LspUninstall" },
opts = function(_, opts)
if not opts.handlers then opts.handlers = {} end
opts.handlers[1] = function(server) require("astronvim.utils.lsp").setup(server) end
end,
config = require "plugins.configs.mason-lspconfig",
},
},
event = "User AstroFile",
config = require "plugins.configs.lspconfig",
},
{
"jose-elias-alvarez/null-ls.nvim",
dependencies = {
{
"jay-babu/mason-null-ls.nvim",
cmd = { "NullLsInstall", "NullLsUninstall" },
opts = { handlers = {} },
},
},
event = "User AstroFile",
opts = function() return { on_attach = require("astronvim.utils.lsp").on_attach } end,
},
{
"stevearc/aerial.nvim",
event = "User AstroFile",
opts = {
attach_mode = "global",
backends = { "lsp", "treesitter", "markdown", "man" },
layout = { min_width = 28 },
show_guides = true,
filter_kind = false,
guides = {
mid_item = "",
last_item = "",
nested_top = "",
whitespace = " ",
},
keymaps = {
["[y"] = "actions.prev",
["]y"] = "actions.next",
["[Y"] = "actions.prev_up",
["]Y"] = "actions.next_up",
["{"] = false,
["}"] = false,
["[["] = false,
["]]"] = false,
},
},
},
}

25
lua/plugins/mason.lua Normal file
View File

@@ -0,0 +1,25 @@
return {
{
"williamboman/mason.nvim",
cmd = {
"Mason",
"MasonInstall",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
"MasonUpdate", -- AstroNvim extension here as well
"MasonUpdateAll", -- AstroNvim specific
},
opts = {
ui = {
icons = {
package_installed = "",
package_uninstalled = "",
package_pending = "",
},
},
},
build = ":MasonUpdate",
config = require "plugins.configs.mason",
},
}

128
lua/plugins/neo-tree.lua Normal file
View File

@@ -0,0 +1,128 @@
local get_icon = require("astronvim.utils").get_icon
return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = { "MunifTanjim/nui.nvim" },
cmd = "Neotree",
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
opts = {
auto_clean_after_session_restore = true,
close_if_last_window = true,
sources = { "filesystem", "buffers", "git_status" },
source_selector = {
winbar = true,
content_layout = "center",
sources = {
{ source = "filesystem", display_name = get_icon("FolderClosed", 1, true) .. "File" },
{ source = "buffers", display_name = get_icon("DefaultFile", 1, true) .. "Bufs" },
{ source = "git_status", display_name = get_icon("Git", 1, true) .. "Git" },
{ source = "diagnostics", display_name = get_icon("Diagnostic", 1, true) .. "Diagnostic" },
},
},
default_component_configs = {
indent = { padding = 0 },
icon = {
folder_closed = get_icon "FolderClosed",
folder_open = get_icon "FolderOpen",
folder_empty = get_icon "FolderEmpty",
folder_empty_open = get_icon "FolderEmpty",
default = get_icon "DefaultFile",
},
modified = { symbol = get_icon "FileModified" },
git_status = {
symbols = {
added = get_icon "GitAdd",
deleted = get_icon "GitDelete",
modified = get_icon "GitChange",
renamed = get_icon "GitRenamed",
untracked = get_icon "GitUntracked",
ignored = get_icon "GitIgnored",
unstaged = get_icon "GitUnstaged",
staged = get_icon "GitStaged",
conflict = get_icon "GitConflict",
},
},
},
commands = {
system_open = function(state) require("astronvim.utils").system_open(state.tree:get_node():get_id()) end,
parent_or_close = function(state)
local node = state.tree:get_node()
if (node.type == "directory" or node:has_children()) and node:is_expanded() then
state.commands.toggle_node(state)
else
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
end
end,
child_or_open = function(state)
local node = state.tree:get_node()
if node.type == "directory" or node:has_children() then
if not node:is_expanded() then -- if unexpanded, expand
state.commands.toggle_node(state)
else -- if expanded and has children, seleect the next child
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
end
else -- if not a directory just open it
state.commands.open(state)
end
end,
copy_selector = function(state)
local node = state.tree:get_node()
local filepath = node:get_id()
local filename = node.name
local modify = vim.fn.fnamemodify
local results = {
e = { val = modify(filename, ":e"), msg = "Extension only" },
f = { val = filename, msg = "Filename" },
F = { val = modify(filename, ":r"), msg = "Filename w/o extension" },
h = { val = modify(filepath, ":~"), msg = "Path relative to Home" },
p = { val = modify(filepath, ":."), msg = "Path relative to CWD" },
P = { val = filepath, msg = "Absolute path" },
}
local messages = {
{ "\nChoose to copy to clipboard:\n", "Normal" },
}
for i, result in pairs(results) do
if result.val and result.val ~= "" then
vim.list_extend(messages, {
{ ("%s."):format(i), "Identifier" },
{ (" %s: "):format(result.msg) },
{ result.val, "String" },
{ "\n" },
})
end
end
vim.api.nvim_echo(messages, false, {})
local result = results[vim.fn.getcharstr()]
if result and result.val and result.val ~= "" then
vim.notify("Copied: " .. result.val)
vim.fn.setreg("+", result.val)
end
end,
},
window = {
width = 30,
mappings = {
["<space>"] = false, -- disable space until we figure out which-key disabling
["[b"] = "prev_source",
["]b"] = "next_source",
o = "open",
O = "system_open",
h = "parent_or_close",
l = "child_or_open",
Y = "copy_selector",
},
},
filesystem = {
follow_current_file = true,
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function(_) vim.opt_local.signcolumn = "auto" end,
},
},
},
}

36
lua/plugins/telescope.lua Normal file
View File

@@ -0,0 +1,36 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
},
cmd = "Telescope",
opts = function()
local actions = require "telescope.actions"
local get_icon = require("astronvim.utils").get_icon
return {
defaults = {
prompt_prefix = get_icon("Selected", 1),
selection_caret = get_icon("Selected", 1),
path_display = { "truncate" },
sorting_strategy = "ascending",
layout_config = {
horizontal = { prompt_position = "top", preview_width = 0.55 },
vertical = { mirror = false },
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
n = { q = actions.close },
},
},
}
end,
config = require "plugins.configs.telescope",
}

View File

@@ -0,0 +1,97 @@
return {
"nvim-treesitter/nvim-treesitter",
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
event = "User AstroFile",
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
build = ":TSUpdate",
opts = {
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
highlight = {
enable = true,
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
},
incremental_selection = { enable = true },
indent = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["ak"] = "@block.outer",
["ik"] = "@block.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["a?"] = "@conditional.outer",
["i?"] = "@conditional.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]k"] = { query = "@block.outer", desc = "Next block start" },
["]c"] = { query = "@class.outer", desc = "Next class start" },
["]f"] = { query = "@function.outer", desc = "Next function start" },
["]a"] = { query = "@parameter.outer", desc = "Next parameter start" },
},
goto_next_end = {
["]k"] = { query = "@block.outer", desc = "Next block end" },
["]c"] = { query = "@class.outer", desc = "Next class end" },
["]f"] = { query = "@function.outer", desc = "Next function end" },
["]a"] = { query = "@parameter.outer", desc = "Next parameter end" },
},
goto_previous_start = {
["[k"] = { query = "@block.outer", desc = "Previous block start" },
["[c"] = { query = "@class.outer", desc = "Previous class start" },
["[f"] = { query = "@function.outer", desc = "Previous function start" },
["[a"] = { query = "@parameter.outer", desc = "Previous parameter start" },
},
goto_previous_end = {
["[K"] = { query = "@block.outer", desc = "Previous block end" },
["[C"] = { query = "@class.outer", desc = "Previous class end" },
["[F"] = { query = "@function.outer", desc = "Previous function end" },
["[A"] = { query = "@parameter.outer", desc = "Previous parameter end" },
},
},
swap = {
enable = true,
swap_next = {
[">k"] = { query = "@block.outer", desc = "Swap next block" },
[">f"] = { query = "@function.outer", desc = "Swap next function" },
[">a"] = { query = "@parameter.inner", desc = "Swap next parameter" },
},
swap_previous = {
["<k"] = { query = "@block.outer", desc = "Swap previous block" },
["<f"] = { query = "@function.outer", desc = "Swap previous function" },
["<a"] = { query = "@parameter.inner", desc = "Swap previous parameter" },
},
},
},
},
config = require "plugins.configs.nvim-treesitter",
}

131
lua/plugins/ui.lua Normal file
View File

@@ -0,0 +1,131 @@
return {
{
"nvim-tree/nvim-web-devicons",
enabled = vim.g.icons_enabled,
opts = {
override = {
default_icon = { icon = require("astronvim.utils").get_icon "DefaultFile" },
deb = { icon = "", name = "Deb" },
lock = { icon = "󰌾", name = "Lock" },
mp3 = { icon = "󰎆", name = "Mp3" },
mp4 = { icon = "", name = "Mp4" },
out = { icon = "", name = "Out" },
["robots.txt"] = { icon = "󰚩", name = "Robots" },
ttf = { icon = "", name = "TrueTypeFont" },
rpm = { icon = "", name = "Rpm" },
woff = { icon = "", name = "WebOpenFontFormat" },
woff2 = { icon = "", name = "WebOpenFontFormat2" },
xz = { icon = "", name = "Xz" },
zip = { icon = "", name = "Zip" },
},
},
},
{
"onsails/lspkind.nvim",
opts = {
mode = "symbol",
symbol_map = {
Array = "󰅪",
Boolean = "",
Class = "󰌗",
Constructor = "",
Key = "󰌆",
Namespace = "󰅪",
Null = "NULL",
Number = "#",
Object = "󰀚",
Package = "󰏗",
Property = "",
Reference = "",
Snippet = "",
String = "󰀬",
TypeParameter = "󰊄",
Unit = "",
},
menu = {},
},
enabled = vim.g.icons_enabled,
config = require "plugins.configs.lspkind",
},
{
"rcarriga/nvim-notify",
init = function() require("astronvim.utils").load_plugin_with_func("nvim-notify", vim, "notify") end,
opts = {
on_open = function(win)
vim.api.nvim_win_set_config(win, { zindex = 1000 })
-- close notification immediately if notifications disabled
if not vim.g.ui_notifications_enabled then vim.api.nvim_win_close(win, true) end
end,
},
config = require "plugins.configs.notify",
},
{
"stevearc/dressing.nvim",
init = function() require("astronvim.utils").load_plugin_with_func("dressing.nvim", vim.ui, { "input", "select" }) end,
opts = {
input = {
default_prompt = "",
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
},
select = {
backend = { "telescope", "builtin" },
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
},
},
},
{
"NvChad/nvim-colorizer.lua",
event = "User AstroFile",
cmd = { "ColorizerToggle", "ColorizerAttachToBuffer", "ColorizerDetachFromBuffer", "ColorizerReloadAllBuffers" },
opts = { user_default_options = { names = false } },
},
{
"lukas-reineke/indent-blankline.nvim",
event = "User AstroFile",
opts = {
buftype_exclude = {
"nofile",
"terminal",
},
filetype_exclude = {
"help",
"startify",
"aerial",
"alpha",
"dashboard",
"lazy",
"neogitstatus",
"NvimTree",
"neo-tree",
"Trouble",
},
context_patterns = {
"class",
"return",
"function",
"method",
"^if",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type",
},
show_trailing_blankline_indent = false,
use_treesitter = true,
char = "",
context_char = "",
show_current_context = true,
},
},
}