update nvim
This commit is contained in:
parent
9aa6f3fdbe
commit
5eec7f512f
6 changed files with 170 additions and 4 deletions
BIN
modules/home/apps/tools/neovim/NeoVim.png
Normal file
BIN
modules/home/apps/tools/neovim/NeoVim.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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("<cmd>qa<cr>")
|
||||
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",
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue