diff --git a/nvim/lua/user/plugins/core.lua b/nvim/lua/user/plugins/core.lua new file mode 100644 index 0000000..54a17b1 --- /dev/null +++ b/nvim/lua/user/plugins/core.lua @@ -0,0 +1,153 @@ +local icons = require('user.icons') + +local backdrop = user.backdrop or 80 + +local border = {" "} + +local toggle_preview = function(picker) + local layout = vim.deepcopy(picker.resolved_layout) + + -- helper: find the "preview" node in the layout tree + local function find_preview(root) + if root.win == "preview" then + return root + end + if #root > 0 then + for _, child in ipairs(root) do + local found = find_preview(child) + if found then + return found + end + end + end + end + + local preview = find_preview(layout.layout) + if not preview then + return + end + + layout.hidden = layout.hidden or {} + + local hidden = false + for i, name in ipairs(layout.hidden) do + if name == "preview" then + hidden = true + table.remove(layout.hidden, i) + break + end + end + + if hidden then + -- preview was hidden -> show it again + -- restore your preferred normal width/height + if layout.layout.width then + layout.layout.width = 0.8 + end + if layout.layout.height then + layout.layout.height = 0.8 + end + else + -- preview was visible -> hide it and compact the picker + table.insert(layout.hidden, "preview") + + -- make the main picker smaller when preview is hidden + -- tweak this depending on your preset + if layout.layout.width then + layout.layout.width = 0.4 + end + if layout.layout.height then + layout.layout.height = 0.4 + end + end + + picker:set_layout(layout) +end + +local finder = { + prompt = " ", + layouts = { + default = { + hidden = { "preview" }, + layout = { + box = "horizontal", + width = 0.4, + height = 0.4, + border = false, + { + box = "vertical", + { win = "list", border = border, title = "Results" }, + { win = "input", border = border, height = 1, title = "{title} {live} {flags}" }, + }, + { win = "preview", border = border, title = "{preview}", width = 0.5 }, + }, + }, + }, + actions = { + toggle_preview_compact = toggle_preview + }, + win = { + input = { + keys = { + [""] = { "close", mode = { "n", "i" } }, + [""] = { "toggle_preview_compact", mode = { "i", "n" } }, + } + } + } +} + +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + picker = finder, + dashboard = { + preset = { + header = [[ + ███▄ █ ▓█████ ▒█████ ██▒ █▓ ██▓ ███▄ ▄███▓ + ██ ▀█ █ ▓█ ▀ ▒██▒ ██▒▓██░ █▒▓██▒▓██▒▀█▀ ██▒ +▓██ ▀█ ██▒▒███ ▒██░ ██▒ ▓██ █▒░▒██▒▓██ ▓██░ +▓██▒ ▐▌██▒▒▓█ ▄ ▒██ ██░ ▒██ █░░░██░▒██ ▒██ +▒██░ ▓██░░▒████▒░ ████▓▒░ ▒▀█░ ░██░▒██▒ ░██▒ +░ ▒░ ▒ ▒ ░░ ▒░ ░░ ▒░▒░▒░ ░ ▐░ ░▓ ░ ▒░ ░ ░ +░ ░░ ░ ▒░ ░ ░ ░ ░ ▒ ▒░ ░ ░░ ▒ ░░ ░ ░ + ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ▒ ░░ ░ + ░ ░ ░ ░ ░ ░ ░ ░ + ░ ]], + keys = { + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + } + }, + notifier = { + style = 'minimal', + margin = { top = 0, right = 2, bottom = 2 }, + gap = 1, + level = vim.log.levels.INFO, + icons = { + info = icons.diagnostics.info .. " ", + warn = icons.diagnostics.warn .. " ", + error = icons.diagnostics.error .. " ", + debug = icons.diagnostics.debug .. " ", + trace = icons.diagnostics.trace .. " " + }, + top_down = false, + }, + styles = { + float = { + backdrop = { + blend = backdrop, + }, + }, + input = { + backdrop = { + blend = backdrop, + }, + }, + }, + } +} diff --git a/nvim/lua/user/plugins/tools.lua b/nvim/lua/user/plugins/tools.lua index 2dadc25..583f10c 100644 --- a/nvim/lua/user/plugins/tools.lua +++ b/nvim/lua/user/plugins/tools.lua @@ -1,5 +1,5 @@ return { - { import = "user.plugins.tools.finder" }, + -- { import = "user.plugins.tools.finder" }, { "mason-org/mason.nvim", build = ":MasonUpdate", diff --git a/nvim/lua/user/plugins/ui.lua b/nvim/lua/user/plugins/ui.lua index 0f3c40f..e712fd8 100644 --- a/nvim/lua/user/plugins/ui.lua +++ b/nvim/lua/user/plugins/ui.lua @@ -2,8 +2,6 @@ local ui = require("user.ui.telescope") local icons = require('user.icons') return { - { import = "user.plugins.ui.dashboard" }, - { import = "user.plugins.ui.editor" }, { import = "user.plugins.ui.colorscheme" }, @@ -41,50 +39,50 @@ return { } } }, - { - 'stevearc/dressing.nvim', - opts = { - input = { - border = { " " }, - relative = "editor", - title_pos = "center", - mappings = { - n = { - [""] = "Close", - [""] = "Confirm", - }, - i = { - [""] = "Close", - [""] = "Confirm", - [""] = "HistoryPrev", - [""] = "HistoryNext", - }, - }, - }, - select = { - backend = { "telescope" }, - telescope = require("telescope.themes").get_dropdown(ui.dropdown), - } - }, - }, + -- { + -- 'stevearc/dressing.nvim', + -- opts = { + -- input = { + -- border = { " " }, + -- relative = "editor", + -- title_pos = "center", + -- mappings = { + -- n = { + -- [""] = "Close", + -- [""] = "Confirm", + -- }, + -- i = { + -- [""] = "Close", + -- [""] = "Confirm", + -- [""] = "HistoryPrev", + -- [""] = "HistoryNext", + -- }, + -- }, + -- }, + -- select = { + -- backend = { "telescope" }, + -- telescope = require("telescope.themes").get_dropdown(ui.dropdown), + -- } + -- }, + -- }, -- Nicer notifications - { - "j-hui/fidget.nvim", - opts = { - notification = { - window = { - normal_hl = "NormalFloat", - winblend = 0, - border = { " " }, - x_padding = 1, - y_padding = 1, - } - }, - progress = { - display = { - done_ttl = 2, - } - } - } - }, + -- { + -- "j-hui/fidget.nvim", + -- opts = { + -- notification = { + -- window = { + -- normal_hl = "NormalFloat", + -- winblend = 0, + -- border = { " " }, + -- x_padding = 1, + -- y_padding = 1, + -- } + -- }, + -- progress = { + -- display = { + -- done_ttl = 2, + -- } + -- } + -- } + -- }, } diff --git a/nvim/lua/user/plugins/ui/colorscheme.lua b/nvim/lua/user/plugins/ui/colorscheme.lua index 73ed638..88d830a 100644 --- a/nvim/lua/user/plugins/ui/colorscheme.lua +++ b/nvim/lua/user/plugins/ui/colorscheme.lua @@ -63,6 +63,11 @@ local custom_highlights = function(colors) TelescopeIndicatorReadonly = { fg = colors.red }, TelescopeIndicatorHidden = { link = "TelescopeResultsComment" }, + -- Snacks picker + SnacksPickerInput = { link = "TelescopePromptNormal" }, + SnacksPickerInputBorder = { link = "TelescopePromptBorder" }, + SnacksPickerResult = { link = "TelescopeResultsNormal" }, + -- Ufo UfoFoldedEllipsis = { link = "Comment" }, @@ -79,6 +84,14 @@ local custom_highlights = function(colors) StatusLineCommand = { fg = colors.base, bg = colors.yellow }, StatusLineReplace = { fg = colors.base, bg = colors.maroon }, + -- Notifications + Notification = { bg = colors.red }, + + -- Dashboard + SnacksDashboardIcon = { fg = colors.lavender }, + SnacksDashboardDesc = { fg = colors.text }, + SnacksDashboardKey = { fg = colors.lavender }, + -- Neotree NeoTreeTabActive = { bg = colors.surface2, fg = colors.lavender }, NeoTreeTabInactive = { bg = colors.crust, fg = colors.surface2 }, @@ -255,7 +268,7 @@ return { priority = 1000, opts = { flavour = "mocha", - transparent_background = not vim.g.neovide, + transparent_background = false, color_overrides = { mocha = { base = "#0E1019", diff --git a/nvim/lua/user/plugins/ui/statusline.lua b/nvim/lua/user/plugins/ui/statusline.lua index 8928599..614e0a2 100644 --- a/nvim/lua/user/plugins/ui/statusline.lua +++ b/nvim/lua/user/plugins/ui/statusline.lua @@ -41,8 +41,9 @@ local options = { section_separators = "", disabled_filetypes = { statusline = { - "dashboard", "alpha", + "dashboard", + "snacks_dashboard" }, winbar = { "neo-tree",