From a804fa6c940f00e292a07cedcd271bb0d2862def Mon Sep 17 00:00:00 2001 From: rootiest Date: Thu, 18 Jul 2024 13:31:21 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Better=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reorganize plugins - Eliminate ui directory - Follows proper config structure --- lua/config/lazy.lua | 4 +- lua/config/ui.lua | 34 +++++++ lua/{ui => plugins}/dashboard.lua | 3 +- lua/plugins/editor.lua | 84 ++++++++++++++++ lua/plugins/image.lua | 28 ------ lua/ui/kitty.lua | 35 ------- lua/ui/ui.lua | 156 ------------------------------ lua/ui/wezterm.lua | 11 --- 8 files changed, 122 insertions(+), 233 deletions(-) create mode 100644 lua/config/ui.lua rename lua/{ui => plugins}/dashboard.lua (98%) delete mode 100644 lua/plugins/image.lua delete mode 100644 lua/ui/kitty.lua delete mode 100644 lua/ui/ui.lua delete mode 100644 lua/ui/wezterm.lua diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index d88fd3c..038ebe0 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,6 +1,7 @@ -- ----------------------------------------------------------------------------- -- ---------------------------------- LAZY ------------------------------------- -- ----------------------------------------------------------------------------- + -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.uv.fs_stat(lazypath) then @@ -19,9 +20,8 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ spec = { { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "ui" }, -- UI Plugins + { import = "config.ui" }, -- UI Plugins { import = "plugins" }, -- General Plugins - { import = "themes" }, -- Theme Plugins }, defaults = { lazy = false, version = false }, checker = { enabled = true }, diff --git a/lua/config/ui.lua b/lua/config/ui.lua new file mode 100644 index 0000000..c39ad3a --- /dev/null +++ b/lua/config/ui.lua @@ -0,0 +1,34 @@ +-- ----------------------------------------------------------------------------- +-- ----------------------------------- UI -------------------------------------- +-- ----------------------------------------------------------------------------- + +return { + { import = "lazyvim.plugins.extras.ui.edgy" }, + { import = "lazyvim.plugins.extras.ui.mini-animate" }, + { + "xiyaowong/transparent.nvim", + event = "VeryLazy", + config = true, + }, + { + "f-person/auto-dark-mode.nvim", + lazy = true, + opts = { + update_interval = 2000, + set_dark_mode = function() + vim.o.background = "dark" + local kitty_theme = os.getenv("KITTY_THEME") + vim.cmd.colorscheme(kitty_theme or "catppuccin-frappe") + end, + set_light_mode = function() + vim.o.background = "light" + local kitty_theme = os.getenv("KITTY_THEME") + vim.cmd.colorscheme(kitty_theme or "catppuccin-latte") + end, + }, + cond = function() -- Not Using SSH + local ssh = os.getenv("SSH_TTY") or false + return not ssh + end, + }, +} diff --git a/lua/ui/dashboard.lua b/lua/plugins/dashboard.lua similarity index 98% rename from lua/ui/dashboard.lua rename to lua/plugins/dashboard.lua index 986fe1e..71438b2 100644 --- a/lua/ui/dashboard.lua +++ b/lua/plugins/dashboard.lua @@ -1,6 +1,7 @@ -- ----------------------------------------------------------------------------- --- -------------------------------- Dashboard ---------------------------------- +-- -------------------------------- DASHBOARD ---------------------------------- -- ----------------------------------------------------------------------------- + return { "nvimdev/dashboard-nvim", opts = function() diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index ab59791..42cdd7f 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -103,4 +103,88 @@ return { event = "VeryLazy", opts = {}, }, + { + "gen740/SmoothCursor.nvim", + event = "InsertEnter", + lazy = true, + config = function() + require("smoothcursor").setup({ + type = "default", + cursor = "", + texthl = "SmoothCursor", + fancy = { + enable = true, -- enable fancy mode + head = { cursor = "", texthl = nil, linehl = nil }, + body = {}, + tail = { false }, -- false to disable fancy tail + }, + matrix = { -- Loaded when 'type' is set to "matrix" + head = { + cursor = require("smoothcursor.matrix_chars"), + texthl = { + "SmoothCursor", + }, + linehl = nil, -- No line highlight for the head + }, + body = { + length = 6, -- Specifies the length of the cursor body + cursor = require("smoothcursor.matrix_chars"), + texthl = { + "SmoothCursorGreen", + }, + }, + tail = { + cursor = nil, + texthl = { + "SmoothCursor", + }, + }, + unstop = false, + }, + autostart = true, -- Automatically start SmoothCursor + always_redraw = true, -- Redraw the screen on each update + flyin_effect = nil, -- Choose "bottom" or "top" for flying effect + speed = 25, -- Max speed is 100 to stick with your current position + intervals = 35, -- Update intervals in milliseconds + priority = 10, -- Set marker priority + timeout = 3000, -- Timeout for animations in milliseconds + threshold = 3, -- Animate only if cursor moves more than this many lines + max_threshold = 2000, -- If you move more than this many lines, don't animate (if `nil`, deactivate check) + disable_float_win = false, -- Disable in floating windows + enabled_filetypes = nil, -- Enable only for specific file types, e.g., { "lua", "vim" } + disabled_filetypes = nil, -- Disable for these file types + show_last_positions = nil, + }) + -- Define cursor color/icon based on mode + local autocmd = vim.api.nvim_create_autocmd + autocmd({ "ModeChanged", "BufEnter" }, { + callback = function() + local current_mode = vim.fn.mode() + if current_mode == "n" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#8aa8f3" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "v" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "V" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "�" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#bf616a" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + elseif current_mode == "i" then + vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#9bd482" }) + vim.fn.sign_define("smoothcursor", { text = "" }) + end + end, + }) + -- Define last cursor position icon + vim.fn.sign_define("smoothcursor_n", { text = "" }) + vim.fn.sign_define("smoothcursor_v", { text = " " }) + vim.fn.sign_define("smoothcursor_V", { text = "" }) + vim.fn.sign_define("smoothcursor_i", { text = "" }) + vim.fn.sign_define("smoothcursor_�", { text = "" }) + vim.fn.sign_define("smoothcursor_R", { text = "󰊄" }) + end, + }, } diff --git a/lua/plugins/image.lua b/lua/plugins/image.lua deleted file mode 100644 index 5f27394..0000000 --- a/lua/plugins/image.lua +++ /dev/null @@ -1,28 +0,0 @@ -package.path = package.path - .. ";" - .. vim.fn.expand("$HOME") - .. "/.luarocks/share/lua/5.1/?/init.lua" -package.path = package.path - .. ";" - .. vim.fn.expand("$HOME") - .. "/.luarocks/share/lua/5.1/?.lua" - --- lazy snippet -return { - "3rd/image.nvim", - config = function() - require("image").setup() - end, - cond = function() - if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.useimage") == 1 then - if - vim.fn.readfile(vim.fn.stdpath("config") .. "/.useimage")[1] - == "true" - then - local term = os.getenv("TERM") or "" - local kit = string.find(term, "kitty") - return kit ~= nil - end - end - end, -} diff --git a/lua/ui/kitty.lua b/lua/ui/kitty.lua deleted file mode 100644 index cbacbac..0000000 --- a/lua/ui/kitty.lua +++ /dev/null @@ -1,35 +0,0 @@ -return { - { - "MunsMan/kitty-navigator.nvim", - build = { - "cp navigate_kitty.py ~/.config/kitty", - "cp pass_keys.py ~/.config/kitty", - }, - cond = function() -- Using Kitty - local term = os.getenv("TERM") or "" - local kit = string.find(term, "kitty") - return kit ~= nil - end, - }, - { - "jghauser/kitty-runner.nvim", - cond = function() -- Using Kitty - local term = os.getenv("TERM") or "" - local kit = string.find(term, "kitty") - return kit ~= nil - end, - }, - { - "mikesmithgh/kitty-scrollback.nvim", - enabled = true, - lazy = true, - cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" }, - event = { "User KittyScrollbackLaunch" }, - version = "*", - config = function() -- Using Kitty-Scrollback - if vim.env.KITTY_SCROLLBACK_NVIM == "true" then - require("kitty-scrollback").setup() - end - end, - }, -} diff --git a/lua/ui/ui.lua b/lua/ui/ui.lua deleted file mode 100644 index 9c47ed6..0000000 --- a/lua/ui/ui.lua +++ /dev/null @@ -1,156 +0,0 @@ -return { - { import = "lazyvim.plugins.extras.ui.edgy" }, - { import = "lazyvim.plugins.extras.ui.mini-animate" }, - { - "xiyaowong/transparent.nvim", - event = "VeryLazy", - config = true, - }, - { - "gen740/SmoothCursor.nvim", - event = "InsertEnter", - lazy = true, - config = function() - require("smoothcursor").setup({ - type = "default", - cursor = "", - texthl = "SmoothCursor", - fancy = { - enable = true, -- enable fancy mode - head = { cursor = "", texthl = nil, linehl = nil }, - body = {}, - tail = { false }, -- false to disable fancy tail - }, - matrix = { -- Loaded when 'type' is set to "matrix" - head = { - cursor = require("smoothcursor.matrix_chars"), - texthl = { - "SmoothCursor", - }, - linehl = nil, -- No line highlight for the head - }, - body = { - length = 6, -- Specifies the length of the cursor body - cursor = require("smoothcursor.matrix_chars"), - texthl = { - "SmoothCursorGreen", - }, - }, - tail = { - cursor = nil, - texthl = { - "SmoothCursor", - }, - }, - unstop = false, - }, - autostart = true, -- Automatically start SmoothCursor - always_redraw = true, -- Redraw the screen on each update - flyin_effect = nil, -- Choose "bottom" or "top" for flying effect - speed = 25, -- Max speed is 100 to stick with your current position - intervals = 35, -- Update intervals in milliseconds - priority = 10, -- Set marker priority - timeout = 3000, -- Timeout for animations in milliseconds - threshold = 3, -- Animate only if cursor moves more than this many lines - max_threshold = 2000, -- If you move more than this many lines, don't animate (if `nil`, deactivate check) - disable_float_win = false, -- Disable in floating windows - enabled_filetypes = nil, -- Enable only for specific file types, e.g., { "lua", "vim" } - disabled_filetypes = nil, -- Disable for these file types - show_last_positions = nil, - }) - -- Define cursor color/icon based on mode - local autocmd = vim.api.nvim_create_autocmd - autocmd({ "ModeChanged", "BufEnter" }, { - callback = function() - local current_mode = vim.fn.mode() - if current_mode == "n" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#8aa8f3" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "v" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "V" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "�" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#bf616a" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - elseif current_mode == "i" then - vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#9bd482" }) - vim.fn.sign_define("smoothcursor", { text = "" }) - end - end, - }) - -- Define last cursor position icon - vim.fn.sign_define("smoothcursor_n", { text = "" }) - vim.fn.sign_define("smoothcursor_v", { text = " " }) - vim.fn.sign_define("smoothcursor_V", { text = "" }) - vim.fn.sign_define("smoothcursor_i", { text = "" }) - vim.fn.sign_define("smoothcursor_�", { text = "" }) - vim.fn.sign_define("smoothcursor_R", { text = "󰊄" }) - end, - }, - { - "akinsho/toggleterm.nvim", - event = "VeryLazy", - config = function() - require("toggleterm").setup({ - -- size can be a number or function which is passed the current terminal - size = function(term) - if term.direction == "horizontal" then - return 10 - elseif term.direction == "vertical" then - return vim.o.columns * 0.4 - end - end, - open_mapping = [[]], - hide_numbers = true, - autochdir = true, - shade_terminals = false, - start_in_insert = true, - insert_mappings = true, - terminal_mappings = true, - persist_size = true, - persist_mode = true, - direction = "horizontal", - close_on_exit = true, - shell = vim.o.shell, - auto_scroll = true, - float_opts = { - border = "curved", - winblend = 3, - title_pos = "left", - }, - winbar = { - enabled = true, - name_formatter = function(term) -- term: Terminal - return term.name - end, - }, - }) - end, - }, - { - "f-person/auto-dark-mode.nvim", - lazy = true, - opts = { - update_interval = 1000, - set_dark_mode = function() - vim.o.background = "dark" - local kitty_theme = os.getenv("KITTY_THEME") - vim.cmd.colorscheme(kitty_theme or "catppuccin-frappe") - end, - set_light_mode = function() - vim.o.background = "light" - local kitty_theme = os.getenv("KITTY_THEME") - vim.cmd.colorscheme(kitty_theme or "catppuccin-latte") - end, - }, - cond = function() -- Not Using SSH or root - local ssh = os.getenv("SSH_TTY") or false - local user = os.getenv("USER") or "" - local root = string.find(user, "root") - return not ssh and not root - end, - }, -} diff --git a/lua/ui/wezterm.lua b/lua/ui/wezterm.lua deleted file mode 100644 index 6d44c65..0000000 --- a/lua/ui/wezterm.lua +++ /dev/null @@ -1,11 +0,0 @@ --- ----------------------------------------------------------------------------- --- --------------------------------- WezTerm ----------------------------------- --- ----------------------------------------------------------------------------- -return { - "willothy/wezterm.nvim", - config = true, - cond = function() -- Using WezTerm - local term = os.getenv("TERM_PROGRAM") - return term and string.find(term, "WezTerm") - end, -}