dotfiles/dot_config/nvim/lua/plugins/ui.lua.tmpl

579 lines
14 KiB
Cheetah
Raw Normal View History

2024-11-24 07:24:26 +01:00
local function getWords()
return vim.fn.wordcount().words
end
2024-02-15 09:53:19 +01:00
return {
2024-02-16 15:27:16 +01:00
{{- if eq .chezmoi.os "openbsd" }}
-- Better `vim.notify()`
{
"rcarriga/nvim-notify",
keys = {
{
"<leader>un",
function()
require("notify").dismiss({ silent = true, pending = true })
2024-02-15 09:53:19 +01:00
end,
desc = "Dismiss all Notifications",
},
2024-02-15 09:53:19 +01:00
},
opts = {
timeout = 3000,
max_height = function()
return math.floor(vim.o.lines * 0.75)
end,
max_width = function()
return math.floor(vim.o.columns * 0.75)
end,
},
},
2024-02-15 09:53:19 +01:00
-- better vim.ui
{
"stevearc/dressing.nvim",
lazy = true,
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.select(...)
end
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.input(...)
end
end,
},
-- statusline
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
init = function()
vim.g.lualine_laststatus = vim.o.laststatus
vim.o.laststatus = 0
end,
opts = {
options = {
theme = 'auto',
icons_enabled = true,
globalstatus = true,
component_separators = "|",
disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } },
},
sections = {
lualine_a = { "mode" },
lualine_b = { { "branch", icon = " " }, "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding",
{
"fileformat",
symbols = {
unix = " ",
dos = " ",
mac = " "
}
},
{ "filetype", icon_only = true } },
lualine_y = { "progress" },
lualine_z = { "location" },
},
2024-02-15 09:53:19 +01:00
},
},
2024-02-15 09:53:19 +01:00
-- Active indent guide and indent text objects. When you're browsing
-- code, this highlights the current level of indentation, and animates
-- the highlighting.
{
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
opts = {
-- symbol = "▏",
symbol = "│",
options = { try_as_border = true },
},
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
2024-02-15 09:53:19 +01:00
},
callback = function()
vim.b.miniindentscope_disable = true
2024-02-15 09:53:19 +01:00
end,
})
end,
},
2024-02-15 09:53:19 +01:00
-- Displays a popup with possible key bindings of the command you started typing
{
"folke/which-key.nvim",
opts = function(_, opts)
opts.defaults["<leader>sn"] = { name = "+noice" }
end,
},
2024-02-15 09:53:19 +01:00
-- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
2024-02-15 09:53:19 +01:00
},
},
routes = {
{
filter = {
event = "msg_show",
any = {
{ find = "%d+L, %d+B" },
{ find = "; after #%d+" },
{ find = "; before #%d+" },
2024-02-15 09:53:19 +01:00
},
},
view = "mini",
2024-02-15 09:53:19 +01:00
},
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
inc_rename = true,
},
2024-02-15 09:53:19 +01:00
},
-- stylua: ignore
keys = {
{
"<S-Enter>",
function() require("noice").redirect(vim.fn.getcmdline()) end,
mode = "c",
desc =
"Redirect Cmdline"
},
{
"<leader>snl",
function() require("noice").cmd("last") end,
desc =
"Noice Last Message"
},
{
"<leader>snh",
function() require("noice").cmd("history") end,
desc =
"Noice History"
},
{
"<leader>sna",
function() require("noice").cmd("all") end,
desc =
"Noice All"
},
{
"<leader>snd",
function() require("noice").cmd("dismiss") end,
desc =
"Dismiss All"
},
{
"<c-f>",
function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end,
silent = true,
expr = true,
desc =
"Scroll forward",
mode = {
"i", "n", "s" }
},
{
"<c-b>",
function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end,
silent = true,
expr = true,
desc =
"Scroll backward",
mode = {
"i", "n", "s" }
},
},
},
2024-02-15 09:53:19 +01:00
-- icons
{
"nvim-tree/nvim-web-devicons",
lazy = true,
opts = function()
local devicons = require("nvim-web-devicons")
local palette = {
orange = "#d18616",
black = "#586069",
bright_black = "#959da5",
white = "#d1d5da",
bright_white = "#fafbfc",
red = "#ea4a5a",
bright_red = "#f97583",
green = "#34d058",
bright_green = "#85e89d",
yellow = "#ffea7f",
bright_yellow = "#ffea7f",
blue = "#2188ff",
bright_blue = "#79b8ff",
magenta = "#b392f0",
bright_magenta = "#b392f0",
cyan = "#39c5cf",
bright_cyan = "#56d4dd",
}
devicons.set_icon({
[".zshrc"] = {
icon = " ",
color = palette.bright_black,
name = "Zshrc",
},
["bash"] = {
icon = " ",
color = palette.bright_black,
name = "Bash",
},
["c"] = {
icon = " ",
color = palette.bright_blue,
name = "C",
},
["c++"] = {
icon = " ",
color = palette.bright_red,
name = "CPlusPlus",
},
["cc"] = {
icon = " ",
color = palette.bright_red,
name = "CPlusPlus",
},
["go"] = {
icon = " ",
color = palette.bright_blue,
name = "Go",
},
["js"] = {
icon = " ",
color = palette.yellow,
name = "Js",
},
["lua"] = {
icon = " ",
color = palette.bright_blue,
name = "Lua",
},
["markdown"] = {
icon = " ",
color = palette.bright_blue,
name = "Markdown",
},
["md"] = {
icon = " ",
color = palette.bright_blue,
name = "Md",
},
["mdx"] = {
icon = " ",
color = palette.bright_blue,
name = "Mdx",
},
["php"] = {
icon = " ",
color = palette.magenta,
name = "Php",
},
["pl"] = {
icon = " ",
color = palette.bright_blue,
name = "Pl",
},
["py"] = {
icon = " ",
color = palette.bright_blue,
name = "Py",
},
["pyc"] = {
icon = " ",
color = palette.bright_blue,
name = "Pyc",
},
["pyd"] = {
icon = " ",
color = palette.bright_blue,
name = "Pyd",
},
["pyo"] = {
icon = " ",
color = palette.bright_blue,
name = "Pyo",
},
["rake"] = {
icon = " ",
color = palette.bright_red,
name = "Rake",
},
["rakefile"] = {
icon = " ",
color = palette.bright_red,
name = "Rakefile",
},
["rb"] = {
icon = " ",
color = palette.bright_red,
name = "Rb",
},
["sh"] = {
icon = " ",
color = palette.bright_black,
name = "Sh",
},
["sql"] = {
icon = " ",
color = palette.bright_black,
name = "Sql",
},
["svelte"] = {
icon = " ",
color = palette.orange,
name = "Svelte"
},
["yaml"] = {
icon = " ",
color = palette.bright_black,
name = "Yaml",
},
["yml"] = {
icon = " ",
color = palette.bright_black,
name = "Yml",
},
["zsh"] = {
icon = " ",
color = palette.bright_black,
name = "Zsh",
},
["terminal"] = {
icon = " ",
color = palette.bright_black,
name = "Terminal",
},
})
end,
},
{
"yamatsum/nvim-nonicons",
dependencies = { "nvim-tree/nvim-web-devicons" },
lazy = true
},
2024-02-16 15:27:16 +01:00
-- ui components
{ "MunifTanjim/nui.nvim", lazy = true },
2024-02-16 15:27:16 +01:00
{{ else }}
2024-01-15 05:38:27 +01:00
-- change lualine
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
opts.sections.lualine_b = { { "branch", icon = " " } }
end,
},
2024-02-16 15:27:16 +01:00
{{ end }}
{
"RRethy/vim-illuminate",
config = function()
-- change the highlight style
vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })
end,
},
{
"NvChad/nvim-colorizer.lua",
opts = function(_, opts)
opts.filetypes = {
"html",
"css",
"scss",
"javascript",
"typescript",
"typescriptreact",
"javascriptreact",
"lua",
}
opts.user_default_options = {
mode = "background",
tailwind = false, -- Enable tailwind colors
}
end,
},
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
opts = function()
vim.api.nvim_set_hl(0, "DashboardHeader", { fg = "#79b8ff" })
vim.api.nvim_set_hl(0, "DashboardIcon", { fg = "#39c5cf" })
vim.api.nvim_set_hl(0, "DashboardKey", { fg = "#39c5cf" })
vim.api.nvim_set_hl(0, "DashboardFooter", { fg = "#959da5" })
local logo = [[
2024-04-04 21:27:51 +02:00
_ _ _ _
2024-02-23 09:46:44 +01:00
| | (_) | | | |
_ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| |
| '_ ` _ \ / _ \ / _ \ '_ \| | | | / __| '_ \ / _` | '_ \ / _` |
| | | | | | (_) | __/ |_) | | |_| \__ \ |_) | (_| | | | | (_| |
2024-04-04 21:27:51 +02:00
|_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_| ]]
2024-02-23 09:46:44 +01:00
logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
center = {
2024-08-14 23:38:45 +02:00
{{- if eq .chezmoi.os "openbsd" }}
{
action = "Telescope find_files",
desc = " Find file",
icon = " ",
key = "f",
},
{
action = "Telescope oldfiles",
desc = " Recent files",
icon = " ",
key = "r",
},
{
action = "Telescope live_grep",
desc = " Find text",
icon = " ",
key = "g",
},
{
action = [[lua require("telescope.builtin").find_files({ cwd = vim.fn.stdpath("config") })]],
2024-08-14 23:38:45 +02:00
desc = " Config",
icon = " ",
key = "c",
},
{
action = "Telekasten find_notes",
desc = " Find notes",
icon = " ",
key = "n",
},
{
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{ action = "qa", desc = " Quit", icon = " ", key = "q" },
{{- else }}
2024-08-14 23:38:45 +02:00
{
action = "lua LazyVim.pick()()",
desc = " Find file",
icon = " ",
key = "f",
},
{
action = "Telescope oldfiles",
desc = " Recent files",
icon = " ",
key = "r",
},
{
action = 'lua LazyVim.pick("live_grep")()',
desc = " Find text",
icon = " ",
key = "g",
},
{
action = "lua LazyVim.pick.config_files()()",
desc = " Config",
icon = " ",
key = "c",
},
{
action = "Telekasten find_notes",
desc = " Find notes",
icon = " ",
key = "n",
},
{
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{ action = "qa", desc = " Quit", icon = " ", key = "q" },
2024-08-14 23:38:45 +02:00
{{- end }}
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
2024-11-24 07:24:26 +01:00
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
},
{
"stevearc/oil.nvim",
opts = {},
2024-11-24 07:24:26 +01:00
config = function()
2024-08-14 23:38:45 +02:00
require("oil").setup({
default_file_explorer = true,
delete_to_trash = true,
skip_confirm_for_simple_edits = true,
view_options = {
show_hidden = true,
natural_order = true,
is_always_hidden = function(name, _)
2024-11-24 07:24:26 +01:00
return name == ".." or name == ".git"
2024-08-14 23:38:45 +02:00
end,
},
win_options = {
wrap = true,
2024-11-24 07:24:26 +01:00
},
2024-08-14 23:38:45 +02:00
})
end,
},
2024-02-15 09:53:19 +01:00
}