Files
nvim/lua/plugins/user.lua
T

117 lines
3.4 KiB
Lua

-- You can also add or configure plugins by creating files in this `plugins/` folder
-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE
-- Here are some examples:
---@type LazySpec
return {
-- customize dashboard options
{
"folke/snacks.nvim",
opts = {
dashboard = {
sections = {
{ section = "header" },
{ section = "keys", gap = 1, padding = 1 },
{
pane = 2,
icon = " ",
desc = "Browse Repo",
padding = 1,
key = "b",
action = function()
Snacks.gitbrowse()
end,
},
{
icon = " ",
desc = "Projects (ghq)",
padding = 1,
key = "p",
action = function()
local repos = vim.fn.systemlist("ghq list -p")
vim.ui.select(repos, { prompt = "Select repository" }, function(dir)
if not dir then return end
vim.cmd.cd(dir)
Snacks.picker.files()
end)
end,
},
function()
local in_git = Snacks.git.get_root() ~= nil
local cmds = {
{
title = "Notifications",
cmd = "gh notify -s -a -n5",
action = function()
vim.ui.open("https://github.com/notifications")
end,
key = "n",
icon = " ",
height = 5,
enabled = true,
},
{
title = "Open Issues",
cmd = "gh issue list -L 3",
key = "i",
action = function()
vim.fn.jobstart("gh issue list --web", { detach = true })
end,
icon = " ",
height = 7,
},
{
icon = " ",
title = "Open PRs",
cmd = "gh pr list -L 3",
key = "P",
action = function()
vim.fn.jobstart("gh pr list --web", { detach = true })
end,
height = 7,
},
{
icon = " ",
title = "Git Status",
cmd = "git --no-pager diff --stat -B -M -C",
height = 10,
},
}
return vim.tbl_map(function(cmd)
return vim.tbl_extend("force", {
pane = 2,
section = "terminal",
enabled = in_git,
padding = 1,
ttl = 5 * 60,
indent = 3,
}, cmd)
end, cmds)
end,
{ section = "startup" },
},
preset = {
header = table.concat({
" █████ ███████ ████████ ██████ ██████ ",
"██ ██ ██ ██ ██ ██ ██ ██",
"███████ ███████ ██ ██████ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████ ",
"",
"███  ██ ██  ██ ██ ███  ███",
"████  ██ ██  ██ ██ ████  ████",
"██ ██  ██ ██  ██ ██ ██ ████ ██",
"██  ██ ██  ██  ██  ██ ██  ██  ██",
"██   ████   ████   ██ ██      ██",
}, "\n"),
},
},
},
},
}