adding initial base config from astrovim

This commit is contained in:
Arjun Patel
2023-02-03 05:53:00 -06:00
commit cac3518985
86 changed files with 6631 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
local utils = require "Comment.utils"
require("Comment").setup(astronvim.user_plugin_opts("plugins.Comment", {
pre_hook = function(ctx)
local location = nil
if ctx.ctype == utils.ctype.blockwise then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == utils.cmotion.v or ctx.cmotion == utils.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring {
key = ctx.ctype == utils.ctype.linewise and "__default" or "__multiline",
location = location,
}
end,
}))
+25
View File
@@ -0,0 +1,25 @@
require("aerial").setup(astronvim.user_plugin_opts("plugins.aerial", {
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,
},
}))
+36
View File
@@ -0,0 +1,36 @@
require("alpha").setup(astronvim.user_plugin_opts("plugins.alpha", {
layout = {
{ type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } },
{
type = "text",
val = astronvim.user_plugin_opts("header", {
" █████ ███████ ████████ ██████ ██████",
"██ ██ ██ ██ ██ ██ ██ ██",
"███████ ███████ ██ ██████ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████",
" ",
" ███  ██ ██  ██ ██ ███  ███",
" ████  ██ ██  ██ ██ ████  ████",
" ██ ██  ██ ██  ██ ██ ██ ████ ██",
" ██  ██ ██  ██  ██  ██ ██  ██  ██",
" ██   ████   ████   ██ ██      ██",
}, false),
opts = { position = "center", hl = "DashboardHeader" },
},
{ type = "padding", val = 5 },
{
type = "group",
val = {
astronvim.alpha_button("LDR f f", " Find File "),
astronvim.alpha_button("LDR f o", " Recents "),
astronvim.alpha_button("LDR f w", " Find Word "),
astronvim.alpha_button("LDR f n", " New File "),
astronvim.alpha_button("LDR f m", " Bookmarks "),
astronvim.alpha_button("LDR S l", " Last Session "),
},
opts = { spacing = 1 },
},
},
opts = { noautocmd = true },
}))
+28
View File
@@ -0,0 +1,28 @@
local npairs = require "nvim-autopairs"
npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", {
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",
},
}))
if not vim.g.autopairs_enabled then npairs.disable() end
local rules = astronvim.user_plugin_opts("nvim-autopairs").add_rules
if vim.tbl_contains({ "function", "table" }, type(rules)) then
npairs.add_rules(type(rules) == "function" and rules(npairs) or rules)
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
+1
View File
@@ -0,0 +1 @@
require("better_escape").setup(astronvim.user_plugin_opts "plugins.better_escape")
+36
View File
@@ -0,0 +1,36 @@
local close_func = function(bufnum)
local bufdelete_avail, bufdelete = pcall(require, "bufdelete")
if bufdelete_avail then
bufdelete.bufdelete(bufnum, true)
else
vim.cmd.bdelete { args = { bufnum }, bang = true }
end
end
require("bufferline").setup(astronvim.user_plugin_opts("plugins.bufferline", {
options = {
offsets = {
{ filetype = "NvimTree", text = "", padding = 1 },
{ filetype = "neo-tree", text = "", padding = 1 },
{ filetype = "Outline", text = "", padding = 1 },
},
buffer_close_icon = astronvim.get_icon "BufferClose",
modified_icon = astronvim.get_icon "FileModified",
close_icon = astronvim.get_icon "NeovimClose",
close_command = close_func,
right_mouse_command = close_func,
max_name_length = 14,
max_prefix_length = 13,
tab_size = 20,
separator_style = "thin",
},
}))
local highlights = require "bufferline.highlights"
vim.api.nvim_create_autocmd("User", {
pattern = "AstroColorScheme",
group = "BufferlineCmds",
desc = "Bufferline apply colors after astronvim colorscheme change",
callback = function()
highlights.reset_icon_hl_cache()
highlights.set_all(require("bufferline.config").update_highlights())
end,
})
+92
View File
@@ -0,0 +1,92 @@
local cmp = require "cmp"
local snip_status_ok, luasnip = pcall(require, "luasnip")
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
if not snip_status_ok then return end
local setup = cmp.setup
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
setup(astronvim.user_plugin_opts("plugins.cmp", {
enabled = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "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(astronvim.lspkind) 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-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "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.expandable() then
luasnip.expand()
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",
}),
},
}))
for setup_opt, setup_table in pairs(astronvim.user_plugin_opts("cmp.setup", {})) do
for pattern, options in pairs(setup_table) do
setup[setup_opt](pattern, options)
end
end
+3
View File
@@ -0,0 +1,3 @@
require("colorizer").setup(
astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } })
)
+3
View File
@@ -0,0 +1,3 @@
local dap = require "dap"
dap.adapters = astronvim.user_plugin_opts("dap.adapters", dap.adapters)
dap.configurations = astronvim.user_plugin_opts("dap.configurations", dap.configurations)
+5
View File
@@ -0,0 +1,5 @@
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(astronvim.user_plugin_opts("plugins.dapui", { floating = { border = "rounded" } }))
+10
View File
@@ -0,0 +1,10 @@
require("dressing").setup(astronvim.user_plugin_opts("plugins.dressing", {
input = {
default_prompt = "",
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
},
select = {
backend = { "telescope", "builtin" },
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
},
}))
+10
View File
@@ -0,0 +1,10 @@
require("gitsigns").setup(astronvim.user_plugin_opts("plugins.gitsigns", {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
}))
+309
View File
@@ -0,0 +1,309 @@
local heirline = require "heirline"
if not astronvim.status then return end
local C = require "default_theme.colors"
local function setup_colors()
local Normal = astronvim.get_hlgroup("Normal", { fg = C.fg, bg = C.bg })
local Comment = astronvim.get_hlgroup("Comment", { fg = C.grey_2, bg = C.bg })
local Error = astronvim.get_hlgroup("Error", { fg = C.red, bg = C.bg })
local StatusLine = astronvim.get_hlgroup("StatusLine", { fg = C.fg, bg = C.grey_4 })
local TabLine = astronvim.get_hlgroup("TabLine", { fg = C.grey, bg = C.none })
local TabLineSel = astronvim.get_hlgroup("TabLineSel", { fg = C.fg, bg = C.none })
local WinBar = astronvim.get_hlgroup("WinBar", { fg = C.grey_2, bg = C.bg })
local WinBarNC = astronvim.get_hlgroup("WinBarNC", { fg = C.grey, bg = C.bg })
local Conditional = astronvim.get_hlgroup("Conditional", { fg = C.purple_1, bg = C.grey_4 })
local String = astronvim.get_hlgroup("String", { fg = C.green, bg = C.grey_4 })
local TypeDef = astronvim.get_hlgroup("TypeDef", { fg = C.yellow, bg = C.grey_4 })
local GitSignsAdd = astronvim.get_hlgroup("GitSignsAdd", { fg = C.green, bg = C.grey_4 })
local GitSignsChange = astronvim.get_hlgroup("GitSignsChange", { fg = C.orange_1, bg = C.grey_4 })
local GitSignsDelete = astronvim.get_hlgroup("GitSignsDelete", { fg = C.red_1, bg = C.grey_4 })
local DiagnosticError = astronvim.get_hlgroup("DiagnosticError", { fg = C.red_1, bg = C.grey_4 })
local DiagnosticWarn = astronvim.get_hlgroup("DiagnosticWarn", { fg = C.orange_1, bg = C.grey_4 })
local DiagnosticInfo = astronvim.get_hlgroup("DiagnosticInfo", { fg = C.white_2, bg = C.grey_4 })
local DiagnosticHint = astronvim.get_hlgroup("DiagnosticHint", { fg = C.yellow_1, bg = C.grey_4 })
local HeirlineInactive = astronvim.get_hlgroup("HeirlineInactive", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("inactive", C.grey_7)
local HeirlineNormal = astronvim.get_hlgroup("HeirlineNormal", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("normal", C.blue)
local HeirlineInsert = astronvim.get_hlgroup("HeirlineInsert", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("insert", C.green)
local HeirlineVisual = astronvim.get_hlgroup("HeirlineVisual", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("visual", C.purple)
local HeirlineReplace = astronvim.get_hlgroup("HeirlineReplace", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("replace", C.red_1)
local HeirlineCommand = astronvim.get_hlgroup("HeirlineCommand", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("command", C.yellow_1)
local HeirlineTerminal = astronvim.get_hlgroup("HeirlineTerminal", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("inactive", HeirlineInsert)
local colors = astronvim.user_plugin_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 = StatusLine.bg,
tabline_fg = StatusLine.bg,
buffer_fg = Comment.fg,
buffer_path_fg = WinBarNC.fg,
buffer_close_fg = Comment.fg,
buffer_bg = StatusLine.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 = StatusLine.bg,
buffer_picker_fg = Error.fg,
tab_close_fg = Error.fg,
tab_close_bg = StatusLine.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
--- a submodule of heirline specific functions and aliases
astronvim.status.heirline = {}
--- A helper function to get the type a tab or buffer is
-- @param self the self table from a heirline component function
-- @param prefix the prefix of the type, either "tab" or "buffer" (Default: "buffer")
-- @return the string of prefix with the type (i.e. "_active" or "_visible")
function astronvim.status.heirline.tab_type(self, prefix)
local tab_type = ""
if self.is_active then
tab_type = "_active"
elseif self.is_visible then
tab_type = "_visible"
end
return (prefix or "buffer") .. tab_type
end
--- Make a list of buffers, rendering each buffer with the provided component
---@param component table
---@return table
astronvim.status.heirline.make_buflist = function(component)
local overflow_hl = astronvim.status.hl.get_attributes("buffer_overflow", true)
return require("heirline.utils").make_buflist(
astronvim.status.utils.surround(
"tab",
function(self)
return {
main = astronvim.status.heirline.tab_type(self) .. "_bg",
left = "tabline_bg",
right = "tabline_bg",
}
end,
{ -- bufferlist
init = function(self) self.tab_type = astronvim.status.heirline.tab_type(self) end,
on_click = { -- add clickable component to each buffer
callback = function(_, minwid) vim.api.nvim_win_set_buf(0, minwid) end,
minwid = function(self) return self.bufnr end,
name = "heirline_tabline_buffer_callback",
},
{ -- add buffer picker functionality to each buffer
condition = function(self) return self._show_picker end,
update = false,
init = function(self)
local bufname = astronvim.status.provider.filename { fallback = "empty_file" }(self)
local label = bufname:sub(1, 1)
local i = 2
while label ~= " " and self._picker_labels[label] do
if i > #bufname then break end
label = bufname:sub(i, i)
i = i + 1
end
self._picker_labels[label] = self.bufnr
self.label = label
end,
provider = function(self)
return astronvim.status.provider.str { str = self.label, padding = { left = 1, right = 1 } }
end,
hl = astronvim.status.hl.get_attributes "buffer_picker",
},
component, -- create buffer component
},
false -- disable surrounding
),
{ provider = astronvim.get_icon "ArrowLeft" .. " ", hl = overflow_hl },
{ provider = astronvim.get_icon "ArrowRight" .. " ", hl = overflow_hl },
function() return vim.t.bufs end, -- use astronvim bufs variable
false -- disable internal caching
)
end
--- Alias to require("heirline.utils").make_tablist
astronvim.status.heirline.make_tablist = require("heirline.utils").make_tablist
--- Run the buffer picker and execute the callback function on the selected buffer
-- @param callback function with a single parameter of the buffer number
function astronvim.status.heirline.buffer_picker(callback)
local tabline = require("heirline").tabline
local buflist = tabline and tabline._buflist[1]
if buflist then
local prev_showtabline = vim.opt.showtabline
buflist._picker_labels = {}
buflist._show_picker = true
vim.opt.showtabline = 2
vim.cmd.redrawtabline()
local char = vim.fn.getcharstr()
local bufnr = buflist._picker_labels[char]
if bufnr then callback(bufnr) end
buflist._show_picker = false
vim.opt.showtabline = prev_showtabline
vim.cmd.redrawtabline()
end
end
heirline.load_colors(setup_colors())
local heirline_opts = astronvim.user_plugin_opts("plugins.heirline", {
{ -- statusline
hl = { fg = "fg", bg = "bg" },
astronvim.status.component.mode(),
astronvim.status.component.git_branch(),
-- TODO: REMOVE THIS WITH v3
astronvim.status.component.file_info(
(astronvim.is_available "bufferline.nvim" or vim.g.heirline_bufferline)
and { filetype = {}, filename = false, file_modified = false }
or nil
),
-- astronvim.status.component.file_info { filetype = {}, filename = false, file_modified = false },
astronvim.status.component.git_diff(),
astronvim.status.component.diagnostics(),
astronvim.status.component.fill(),
astronvim.status.component.cmd_info(),
astronvim.status.component.fill(),
astronvim.status.component.lsp(),
astronvim.status.component.treesitter(),
astronvim.status.component.nav(),
astronvim.status.component.mode { surround = { separator = "right" } },
},
{ -- winbar
static = {
disabled = {
buftype = { "terminal", "prompt", "nofile", "help", "quickfix" },
filetype = { "NvimTree", "neo%-tree", "dashboard", "Outline", "aerial" },
},
},
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
fallthrough = false,
{
condition = function(self)
return vim.opt.diff:get() or astronvim.status.condition.buffer_matches(self.disabled or {})
end,
init = function() vim.opt_local.winbar = nil end,
},
astronvim.status.component.file_info {
condition = function() return not astronvim.status.condition.is_active() end,
unique_path = {},
file_icon = { hl = astronvim.status.hl.file_icon "winbar" },
file_modified = false,
file_read_only = false,
hl = astronvim.status.hl.get_attributes("winbarnc", true),
surround = false,
update = "BufEnter",
},
astronvim.status.component.breadcrumbs { hl = astronvim.status.hl.get_attributes("winbar", true) },
},
vim.g.heirline_bufferline -- TODO v3: remove this option and make bufferline default
and { -- bufferline
{ -- file tree padding
condition = function(self)
self.winid = vim.api.nvim_tabpage_list_wins(0)[1]
return astronvim.status.condition.buffer_matches(
{ filetype = { "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)) end,
hl = { bg = "tabline_bg" },
},
astronvim.status.heirline.make_buflist(astronvim.status.component.tabline_file_info()), -- component for each buffer tab
astronvim.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
astronvim.status.heirline.make_tablist { -- component for each tab
provider = astronvim.status.provider.tabnr(),
hl = function(self)
return astronvim.status.hl.get_attributes(astronvim.status.heirline.tab_type(self, "tab"), true)
end,
},
{ -- close button for current tab
provider = astronvim.status.provider.close_button { kind = "TabClose", padding = { left = 1, right = 1 } },
hl = astronvim.status.hl.get_attributes("tab_close", true),
on_click = { callback = astronvim.close_tab, name = "heirline_tabline_close_tab_callback" },
},
},
}
or nil,
})
heirline.setup(heirline_opts[1], heirline_opts[2], heirline_opts[3])
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,
})
vim.api.nvim_create_autocmd("User", {
pattern = "HeirlineInitWinbar",
group = augroup,
desc = "Disable winbar for some filetypes",
callback = function()
if
vim.opt.diff:get()
or astronvim.status.condition.buffer_matches(require("heirline").winbar.disabled or {
buftype = { "terminal", "prompt", "nofile", "help", "quickfix" },
filetype = { "NvimTree", "neo%-tree", "dashboard", "Outline", "aerial" },
}) -- TODO v3: remove the default fallback here
then
vim.opt_local.winbar = nil
end
end,
})
+45
View File
@@ -0,0 +1,45 @@
require("indent_blankline").setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
buftype_exclude = {
"nofile",
"terminal",
},
filetype_exclude = {
"help",
"startify",
"aerial",
"alpha",
"dashboard",
"packer",
"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,
}))
+3
View File
@@ -0,0 +1,3 @@
local indent_o_matic = require "indent-o-matic"
indent_o_matic.setup(astronvim.user_plugin_opts "plugins.indent-o-matic")
indent_o_matic.detect()
+13
View File
@@ -0,0 +1,13 @@
if vim.g.lsp_handlers_enabled then
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
end
local setup_servers = function()
vim.tbl_map(astronvim.lsp.setup, astronvim.user_plugin_opts "lsp.servers")
vim.cmd "silent! do FileType"
end
if astronvim.is_available "mason-lspconfig.nvim" then
vim.api.nvim_create_autocmd("User", { pattern = "AstroLspSetup", once = true, callback = setup_servers })
else
setup_servers()
end
+23
View File
@@ -0,0 +1,23 @@
astronvim.lspkind = astronvim.user_plugin_opts("plugins.lspkind", {
mode = "symbol",
symbol_map = {
NONE = "",
Array = "",
Boolean = "",
Class = "",
Constructor = "",
Key = "",
Namespace = "",
Null = "NULL",
Number = "#",
Object = "⦿",
Package = "",
Property = "",
Reference = "",
Snippet = "",
String = "𝓐",
TypeParameter = "",
Unit = "",
},
})
require("lspkind").init(astronvim.lspkind)
+17
View File
@@ -0,0 +1,17 @@
local user_settings = astronvim.user_plugin_opts "luasnip"
local luasnip = require "luasnip"
if user_settings.config then luasnip.config.setup(user_settings.config) end
for _, load_type in ipairs { "vscode", "snipmate", "lua" } do
local loader = require("luasnip.loaders.from_" .. load_type)
loader.lazy_load()
-- TODO: DEPRECATE _snippet_paths option in next major version release
local paths = user_settings[load_type .. "_snippet_paths"]
if paths then loader.lazy_load { paths = paths } end
local loader_settings = user_settings[load_type]
if loader_settings then loader.lazy_load(loader_settings) end
end
if type(user_settings.filetype_extend) == "table" then
for filetype, snippets in pairs(user_settings.filetype_extend) do
luasnip.filetype_extend(filetype, snippets)
end
end
+6
View File
@@ -0,0 +1,6 @@
local mason_lspconfig = require "mason-lspconfig"
mason_lspconfig.setup(astronvim.user_plugin_opts "plugins.mason-lspconfig")
mason_lspconfig.setup_handlers(
astronvim.user_plugin_opts("mason-lspconfig.setup_handlers", { function(server) astronvim.lsp.setup(server) end })
)
astronvim.event "LspSetup"
+3
View File
@@ -0,0 +1,3 @@
local mason_null_ls = require "mason-null-ls"
mason_null_ls.setup(astronvim.user_plugin_opts("plugins.mason-null-ls", { automatic_setup = true }))
mason_null_ls.setup_handlers(astronvim.user_plugin_opts("mason-null-ls.setup_handlers", {}))
+3
View File
@@ -0,0 +1,3 @@
local mason_nvim_dap = require "mason-nvim-dap"
mason_nvim_dap.setup(astronvim.user_plugin_opts("plugins.mason-nvim-dap", { automatic_setup = true }))
mason_nvim_dap.setup_handlers(astronvim.user_plugin_opts("mason-nvim-dap.setup_handlers", {}))
+13
View File
@@ -0,0 +1,13 @@
require("mason").setup(astronvim.user_plugin_opts("plugins.mason", {
ui = {
icons = {
package_installed = "",
package_uninstalled = "",
package_pending = "",
},
},
}))
local cmd = vim.api.nvim_create_user_command
cmd("MasonUpdateAll", function() astronvim.mason.update_all() end, { desc = "Update Mason Packages" })
cmd("MasonUpdate", function(opts) astronvim.mason.update(opts.args) end, { nargs = 1, desc = "Update Mason Package" })
+67
View File
@@ -0,0 +1,67 @@
require("neo-tree").setup(astronvim.user_plugin_opts("plugins.neo-tree", {
close_if_last_window = true,
enable_diagnostics = false,
source_selector = {
winbar = true,
content_layout = "center",
tab_labels = {
filesystem = astronvim.get_icon "FolderClosed" .. " File",
buffers = astronvim.get_icon "DefaultFile" .. " Bufs",
git_status = astronvim.get_icon "Git" .. " Git",
diagnostics = astronvim.get_icon "Diagnostic" .. " Diagnostic",
},
},
default_component_configs = {
indent = { padding = 0 },
icon = {
folder_closed = astronvim.get_icon "FolderClosed",
folder_open = astronvim.get_icon "FolderOpen",
folder_empty = astronvim.get_icon "FolderEmpty",
default = astronvim.get_icon "DefaultFile",
},
git_status = {
symbols = {
added = astronvim.get_icon "GitAdd",
deleted = astronvim.get_icon "GitDelete",
modified = astronvim.get_icon "GitChange",
renamed = astronvim.get_icon "GitRenamed",
untracked = astronvim.get_icon "GitUntracked",
ignored = astronvim.get_icon "GitIgnored",
unstaged = astronvim.get_icon "GitUnstaged",
staged = astronvim.get_icon "GitStaged",
conflict = astronvim.get_icon "GitConflict",
},
},
},
window = {
width = 30,
mappings = {
["<space>"] = false, -- disable space until we figure out which-key disabling
o = "open",
H = "prev_source",
L = "next_source",
},
},
filesystem = {
filtered_items = {
visible = true,
hide_dotfiles = false,
hide_gitignored = false,
},
follow_current_file = true,
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
window = {
mappings = {
O = "system_open",
h = "toggle_hidden",
},
},
commands = {
system_open = function(state) astronvim.system_open(state.tree:get_node():get_id()) end,
},
},
event_handlers = {
{ event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end },
},
}))
+3
View File
@@ -0,0 +1,3 @@
local notify = require "notify"
notify.setup(astronvim.user_plugin_opts("plugins.notify", { stages = "fade" }))
vim.notify = notify
+1
View File
@@ -0,0 +1 @@
require("null-ls").setup(astronvim.user_plugin_opts("plugins.null-ls", { on_attach = astronvim.lsp.on_attach }))
+15
View File
@@ -0,0 +1,15 @@
require("nvim-web-devicons").set_default_icon(astronvim.get_icon "DefaultFile", "#6d8086", "66")
require("nvim-web-devicons").set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", {
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" },
}))
+8
View File
@@ -0,0 +1,8 @@
return {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
}
@@ -0,0 +1,16 @@
return {
settings = {
Lua = {
telemetry = { enable = false },
runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim", "astronvim", "astronvim_installation", "packer_plugins", "bit" } },
workspace = {
library = {
vim.fn.expand "$VIMRUNTIME/lua",
astronvim.install.home .. "/lua",
astronvim.install.config .. "/lua",
},
},
},
},
}
+1
View File
@@ -0,0 +1 @@
require("session_manager").setup(astronvim.user_plugin_opts "plugins.session_manager")
+9
View File
@@ -0,0 +1,9 @@
require("smart-splits").setup(astronvim.user_plugin_opts("plugins.smart-splits", {
ignored_filetypes = {
"nofile",
"quickfix",
"qf",
"prompt",
},
ignored_buftypes = { "nofile" },
}))
+39
View File
@@ -0,0 +1,39 @@
local telescope = require "telescope"
local actions = require "telescope.actions"
telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
defaults = {
file_ignore_patterns = { "node_modules" },
prompt_prefix = string.format("%s ", astronvim.get_icon "Search"),
selection_caret = string.format("%s ", astronvim.get_icon "Selected"),
path_display = { "truncate" },
sorting_strategy = "ascending",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
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 },
},
},
}))
astronvim.conditional_func(telescope.load_extension, pcall(require, "notify"), "notify")
astronvim.conditional_func(telescope.load_extension, pcall(require, "aerial"), "aerial")
+13
View File
@@ -0,0 +1,13 @@
require("toggleterm").setup(astronvim.user_plugin_opts("plugins.toggleterm", {
size = 10,
open_mapping = [[<F7>]],
shading_factor = 2,
direction = "float",
float_opts = {
border = "curved",
highlights = {
border = "Normal",
background = "Normal",
},
},
}))
+19
View File
@@ -0,0 +1,19 @@
require("nvim-treesitter.configs").setup(astronvim.user_plugin_opts("plugins.treesitter", {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
disable = { "html" },
extended_mode = false,
max_file_lines = nil,
},
autotag = { enable = true },
incremental_selection = { enable = true },
indent = { enable = false },
}))
+55
View File
@@ -0,0 +1,55 @@
local is_available = astronvim.is_available
local user_plugin_opts = astronvim.user_plugin_opts
local mappings = {
n = {
["<leader>"] = {
f = { name = "File" },
p = { name = "Packages" },
l = { name = "LSP" },
u = { name = "UI" },
},
},
}
local extra_sections = {
b = "Buffers",
D = "Debugger",
g = "Git",
s = "Search",
S = "Session",
t = "Terminal",
}
local function init_table(mode, prefix, idx)
if not mappings[mode][prefix][idx] then mappings[mode][prefix][idx] = { name = extra_sections[idx] } end
end
-- TODO v3: remove vim.g.heirline_bufferline check
if is_available "heirline.nvim" and vim.g.heirline_bufferline then init_table("n", "<leader>", "b") end
if is_available "neovim-session-manager" then init_table("n", "<leader>", "S") end
if is_available "gitsigns.nvim" then init_table("n", "<leader>", "g") end
if is_available "toggleterm.nvim" then
init_table("n", "<leader>", "g")
init_table("n", "<leader>", "t")
end
if is_available "telescope.nvim" then
init_table("n", "<leader>", "s")
init_table("n", "<leader>", "g")
end
if is_available "nvim-dap" then init_table("n", "<leader>", "D") end
if is_available "Comment.nvim" then
for _, mode in ipairs { "n", "v" } do
if not mappings[mode] then mappings[mode] = {} end
if not mappings[mode].g then mappings[mode].g = {} end
mappings[mode].g.c = "Comment toggle linewise"
mappings[mode].g.b = "Comment toggle blockwise"
end
end
astronvim.which_key_register(user_plugin_opts("which-key.register", mappings))
+11
View File
@@ -0,0 +1,11 @@
require("which-key").setup(astronvim.user_plugin_opts("plugins.which-key", {
plugins = {
spelling = { enabled = true },
presets = { operators = false },
},
window = {
border = "rounded",
padding = { 2, 2, 2, 2 },
},
disable = { filetypes = { "TelescopePrompt" } },
}))
+4
View File
@@ -0,0 +1,4 @@
local colors = require "default_theme.colors"
require("window-picker").setup(
astronvim.user_plugin_opts("plugins.window-picker", { use_winbar = "smart", other_win_hl_color = colors.grey_4 })
)