diff --git a/flake.lock b/flake.lock index 7648f41..8ab7b12 100644 --- a/flake.lock +++ b/flake.lock @@ -2395,11 +2395,11 @@ "systems": "systems_18" }, "locked": { - "lastModified": 1730322983, - "narHash": "sha256-zsKDqUT18EG9ceR1ieYzRwrU/J7cVdocyFoXvQ4QMDM=", + "lastModified": 1731607548, + "narHash": "sha256-a0xLkdgQ4TIJVtY8fXnidtmsqlg63V9YYM7Hf32m7pk=", "ref": "refs/heads/main", - "rev": "e3da619b0a04a0f02d437a784318f142807a1e94", - "revCount": 74, + "rev": "49677f2d9b2cb94c36fe7a9df2bd5e9a8c00b94f", + "revCount": 75, "type": "git", "url": "https://git.zoeys.computer/zoey/zoeys.computer" }, diff --git a/modules/home/apps/tools/neovim/NeoVim.png b/modules/home/apps/tools/neovim/NeoVim.png new file mode 100644 index 0000000..7eea350 Binary files /dev/null and b/modules/home/apps/tools/neovim/NeoVim.png differ diff --git a/modules/home/apps/tools/neovim/config/lua/config/autocmds.lua b/modules/home/apps/tools/neovim/config/lua/config/autocmds.lua index 27e9e06..8547353 100644 --- a/modules/home/apps/tools/neovim/config/lua/config/autocmds.lua +++ b/modules/home/apps/tools/neovim/config/lua/config/autocmds.lua @@ -1,3 +1,4 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here +-- Create autocommand group diff --git a/modules/home/apps/tools/neovim/config/lua/plugins/core.lua b/modules/home/apps/tools/neovim/config/lua/plugins/core.lua index e710d6a..ec43fe8 100644 --- a/modules/home/apps/tools/neovim/config/lua/plugins/core.lua +++ b/modules/home/apps/tools/neovim/config/lua/plugins/core.lua @@ -7,6 +7,84 @@ return { }, }, "f-person/git-blame.nvim", + { + "3rd/image.nvim", + build = false, + lazy = false, + config = function() + require("image").setup({ + backend = "kitty", + kitty_method = "normal", + processor = "magick_cli", + integrations = { + markdown = { + enabled = true, + }, + }, + }) + end, + }, + { + "nvimdev/dashboard-nvim", + event = "VimEnter", + lazy = true, + opts = function() + local logo = "" + logo = string.rep("\n", 12) .. logo .. "\n\n" + local opts = { + theme = "hyper", + hide = { + statusline = true, + }, + config = { + header = vim.split(logo, "\n"), + shortcut = { + { + desc = "Find File", + action = "lua LazyVim.pick()()", + key = "f", + }, + { + desc = "New File", + action = "ene | startinsert", + key = "n", + }, + { + desc = "Lazy", + action = "Lazy", + icon = "󰒲 ", + key = "l", + }, + { + desc = "Quit", + action = function() + vim.api.nvim_input("qa") + end, + key = "q", + }, + }, + packages = { enable = true }, -- show how many plugins neovim loaded + project = { enable = true, limit = 8 }, + mru = { limit = 10 }, + }, + } + + -- Handle reopening dashboard after closing lazy + if vim.o.filetype == "lazy" then + vim.api.nvim_create_autocmd("WinClosed", { + pattern = tostring(vim.api.nvim_get_current_win()), + once = true, + callback = function() + vim.schedule(function() + vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) + end) + end, + }) + end + + return opts + end, + }, { "nvim-lualine/lualine.nvim", enabled = false }, -- { -- "nvim-neorg/neorg", diff --git a/modules/home/apps/tools/neovim/default.nix b/modules/home/apps/tools/neovim/default.nix index 90dfd04..ba5801c 100644 --- a/modules/home/apps/tools/neovim/default.nix +++ b/modules/home/apps/tools/neovim/default.nix @@ -39,6 +39,7 @@ in { enable = true; defaultEditor = true; package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; + extraLuaPackages = ps: [ps.magick]; extraPackages = with pkgs; [ # Formatters alejandra # Nix @@ -49,6 +50,8 @@ in { stylua rustywind + imagemagick + # LSP lua-language-server nixd @@ -136,6 +139,89 @@ in { vim.opt.rtp:prepend(lazypath) require('config.lazy') + + local dashboardImage = vim.api.nvim_create_augroup("DashboardImage", { clear = true }) + local img = require("image").from_file("${./NeoVim.png}") + local is_visible = false + + -- Known image dimensions + local IMG_WIDTH = 50 -- characters + local IMG_HEIGHT = 14 -- lines + + -- Debug notification function + local function debug_notify(message) + -- vim.notify(message, vim.log.levels.INFO) + end + + -- Function to calculate centered position + local function center_image() + local win_width = vim.o.columns + local win_height = vim.o.lines + + local x = math.floor((win_width - IMG_WIDTH) / 2) + local y = math.floor((win_height - IMG_HEIGHT) / 6) + + return math.max(0, x), math.max(0, y) + end + + -- Function to update image position + local function update_image() + debug_notify("Attempting to update image. is_visible = " .. tostring(is_visible)) + if is_visible then + local x, y = center_image() + debug_notify("Positioning image at x=" .. x .. ", y=" .. y) + img:clear() + img:render() + img:move(x, y) + end + end + + -- Show image on both VimEnter and when dashboard buffer is created + vim.api.nvim_create_autocmd({ "VimEnter", "BufWinEnter", "BufEnter" }, { + group = dashboardImage, + callback = function(ev) + local filetype = vim.api.nvim_buf_get_option(ev.buf, "filetype") + debug_notify("Event triggered: " .. ev.event .. ", filetype: " .. filetype) + if filetype == "dashboard" then + debug_notify("Dashboard detected, setting visible") + is_visible = true + vim.schedule(update_image) + end + end, + }) + + -- Handle window resize + vim.api.nvim_create_autocmd("VimResized", { + group = dashboardImage, + callback = function() + debug_notify("Window resized") + update_image() + end, + }) + + -- Clear image when leaving dashboard + vim.api.nvim_create_autocmd("BufLeave", { + group = dashboardImage, + callback = function() + debug_notify("Leaving buffer") + is_visible = false + img:clear() + end, + }) + + -- Catch when returning to dashboard + vim.api.nvim_create_autocmd("FileType", { + group = dashboardImage, + pattern = "dashboard", + callback = function() + debug_notify("FileType dashboard detected") + is_visible = true + vim.schedule(update_image) + end, + }) + + -- Initial debug message + debug_notify("Dashboard image setup loaded") ''; }; diff --git a/modules/home/apps/tools/tmux/default.nix b/modules/home/apps/tools/tmux/default.nix index a028d6a..baef463 100644 --- a/modules/home/apps/tools/tmux/default.nix +++ b/modules/home/apps/tools/tmux/default.nix @@ -38,6 +38,7 @@ in { set -g @catppuccin_flavor "mocha" set -g @catppuccin_window_status_style "basic" set -g default-terminal "tmux-256color" + set -g allow-passthrough on set -g status-right-length 100 set -g status-left-length 100