diff --git a/init.lua b/init.lua index 2647dfe..66614ec 100644 --- a/init.lua +++ b/init.lua @@ -53,7 +53,3 @@ -- ---------------------------------- LAZY ------------------------------------- -- Load Lazy package manager and plugins require("config.lazy") - --- -------------------------------- ROOTIEST ----------------------------------- --- Load the rootiest configuration -require("config.rootiest").setup() diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 1b769b6..f4b696f 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -8,7 +8,7 @@ local substitute_loaded, substitute = pcall(require, "substitute") local codesnap_loaded = pcall(require, "codesnap") local icon_picker_loaded = pcall(require, "icon-picker") local gist_loaded = pcall(require, "gist") -local rootiest = require("config.rootiest") +local rootiest = require("rootiest") local wk = require("which-key") wk.add({ @@ -327,6 +327,3 @@ wk.add({ end, }, }) - --- ---------------------------- Spell Correction ------------------------------- -require("config.spellcheck") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 8b1d844..32cd881 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -20,6 +20,7 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ spec = { { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + { import = "config.rootiest" }, -- Rootiest Plugin { import = "plugins" }, -- General Plugins }, defaults = { lazy = false, version = false }, diff --git a/lua/config/neovide.lua b/lua/config/neovide.lua deleted file mode 100644 index 5ce9f53..0000000 --- a/lua/config/neovide.lua +++ /dev/null @@ -1,45 +0,0 @@ --- ----------------------------------------------------------------------------- --- --------------------------------- NEOVIDE ----------------------------------- --- ----------------------------------------------------------------------------- - --- Set GUI font -vim.opt.guifont = "Iosevka:#e-subpixelantialias:h12" --- refresh rate and translucency -vim.g.neovide_refresh_rate = 170 -vim.g.neovide_transparency = 0.85 -vim.g.neovide_window_blurred = true --- cursor fx -vim.g.neovide_cursor_vfx_mode = "railgun" -vim.g.neovide_cursor_smooth_blink = true -vim.g.neovide_cursor_vfx_particle_density = 16.0 -vim.g.neovide_cursor_vfx_particle_lifetime = 1.6 -vim.g.neovide_cursor_vfx_particle_phase = 1.2 -vim.g.neovide_cursor_vfx_particle_curl = 1.0 -vim.g.neovide_cursor_animation_length = 0.13 -vim.g.neovide_cursor_trail_size = 0.8 --- floating shadow -vim.g.neovide_floating_shadow = true -vim.g.neovide_floating_z_height = 10 -vim.g.neovide_light_angle_degrees = 45 -vim.g.neovide_light_radius = 5 --- scaling -vim.g.neovide_scale_factor = 1.0 --- padding -vim.g.neovide_padding_top = 0 -vim.g.neovide_padding_bottom = 0 -vim.g.neovide_padding_right = 0 -vim.g.neovide_padding_left = 0 - --- Simulate kitty copy-and-paste from system clipboard --- in normal mode -vim.cmd(":nnoremap :r !xsel -b") -vim.cmd(":nnoremap :w !xsel -i -b") --- and in visual mode -vim.cmd(":vnoremap :r !xsel -b") -vim.cmd(":vnoremap :w !xsel -i -b") --- and in command mode -vim.cmd(":cnoremap +") -vim.cmd(":cnoremap +") --- and in insert mode -vim.cmd(":inoremap +") -vim.cmd(":inoremap +") diff --git a/lua/config/rootiest.lua b/lua/config/rootiest.lua index 7aeafe9..c4f41cc 100644 --- a/lua/config/rootiest.lua +++ b/lua/config/rootiest.lua @@ -1,230 +1,4 @@ -local M = {} - -local precog_first_time = true - --- Define the config path and default values -local config_path = vim.fn.stdpath("config") - -function M.set_defaults() - -- Set Default Leader Key - vim.g.mapleader = " " - vim.g.maplocalleader = "\\" -end - -function M.eval_settings_files() - -- Function to ensure a file exists and write a default value if it doesn't - local function ensure_file_exists(file_path, default_value, setup_func) - if vim.fn.filereadable(file_path) ~= 1 then - if setup_func then - -- Call the setup function if provided - setup_func() - else - -- Write default value to file - vim.fn.writefile({ default_value }, file_path) - end - end - end - - local defaults = { - [config_path .. "/.aitool"] = "codeium", - [config_path .. "/.useimage"] = "true", - [config_path .. "/.wakatime"] = "true", - [config_path .. "/.hardtime"] = "false", - [config_path .. "/.ignore-deps"] = "false", - [config_path .. "/.leader"] = vim.g.mapleader, - } - - -- Function to handle special logic for the .colorscheme file - local function setup_colorscheme() - local color_file = config_path .. "/.colorscheme" - if M.kitty_theme then - vim.fn.writefile({ M.kitty_theme }, color_file) - else - vim.fn.writefile({ vim.g.colors_name }, color_file) - end - end - - -- Ensure each file exists with the corresponding default value or special logic - for file_path, default_value in pairs(defaults) do - ensure_file_exists(file_path, default_value) - end - - -- Ensure the .colorscheme file exists with special logic - ensure_file_exists(config_path .. "/.colorscheme", nil, setup_colorscheme) -end - -function M.restore_colorscheme() - -- Restore colorscheme - vim.cmd.colorscheme(M.colortheme or "catppuccin-frappe" or "tokyonight") -end - -function M.yank_line() - -- Yank line without leading/trailing whitespace - vim.api.nvim_feedkeys("_v$hy$", "n", true) -end - -function M.using_kitty() - local term = os.getenv("TERM") or "" - local kit = string.find(term, "kitty") - return kit ~= nil -end - -function M.toggle_precognition() - if precog_first_time then - require("precognition").toggle() - require("precognition").toggle() -- Call toggle twice - precog_first_time = false -- Update variable after the first call - else - require("precognition").toggle() -- Call toggle once - end -end - -function M.toggle_hardmode() - require("hardtime").toggle() - M.toggle_precognition() -end - -function M.toggle_lazygit_term() - local Terminal = require("toggleterm.terminal").Terminal - local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) - lazygit:toggle() -end - --- Function to check if a given string matches the content of the .aitool file -function M.using_aitool(input) - local aitool_file = config_path .. "/.aitool" - - -- Ensure the .aitool file exists - if vim.fn.filereadable(aitool_file) ~= 1 then - vim.fn.writefile({ "codeium" }, aitool_file) - end - - -- Read the file and normalize its content - local content = vim.fn.readfile(aitool_file)[1] or "" - local normalized_content = content:lower():gsub("%s+", "") - - -- Normalize the input and compare - local normalized_input = input:lower():gsub("%s+", "") - return normalized_input == normalized_content -end - -function M.load_remote() - ---@diagnostic disable-next-line: missing-parameter - require("remote-nvim").setup() - vim.cmd("RemoteStart") -end - -function M.set_cursor_icons() - -- 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 - -function M.eval_dependencies() - -- Function to read the .ignore-deps file and return whether warnings should be suppressed - local function should_suppress_warnings() - local ignore_file = config_path .. "/.ignore-deps" - local file = io.open(ignore_file, "r") - if file then - local content = file:read("*a") - file:close() - content = content:lower():gsub("%s+", "") -- convert to lowercase and remove whitespace - local suppress_values = { ["true"] = true, ["1"] = true, ["yes"] = true } - return suppress_values[content] or false - end - return false - end - - -- Function to check if an executable is installed and generate a warning if not - local function check_executable(executable) - if vim.fn.executable(executable) ~= 1 then - vim.api.nvim_notify( - executable .. " is not installed!", - vim.log.levels.WARN, - {} - ) - end - end - - -- Check if warnings should be suppressed - if not should_suppress_warnings() then - -- List of executables to check - local executables = - { "lazygit", "gh", "rg", "fzf", "fd", "git", "luarocks" } - - -- Check each executable - for _, executable in ipairs(executables) do - check_executable(executable) - end - end -end - -function M.eval_neovide() - if vim.g.neovide then - require("config.neovide") - end -end - --- -------------------------------- Commands ----------------------------------- -function M.define_commands() - -- Make :Q close all of the buffers - vim.api.nvim_create_user_command("Q", function() - vim.cmd.qall() - end, { force = true, desc = "Close all buffers" }) - - -- Yank line without leading/trailing whitespace - vim.api.nvim_create_user_command("YankLine", function() - M.yank_line() - end, { force = true, desc = "Yank line without leading whitespace" }) - - -- Restore Colorscheme - -- Define the RestoreColorscheme command - vim.api.nvim_create_user_command( - "RestoreColorscheme", -- Command name - function() -- Callback function - M.restore_colorscheme() - end, - { desc = "Restore colorscheme" } - ) - - -- Load/start Remote - vim.api.nvim_create_user_command("LoadRemote", function() - M.load_remote() - end, { force = true, desc = "Load/start Remote" }) -end - --- ------------------------------- Variables ----------------------------------- --- Load the kitty theme -M.kitty_theme = os.getenv("KITTY_THEME") - --- Load the stored colorscheme -M.colortheme = vim.fn.readfile(config_path .. "/.colorscheme")[1] - --- Load Stored Leader Key -M.leader = vim.fn.readfile(config_path .. "/.leader")[1] - --- --------------------------------- Setup ------------------------------------- -function M.setup() - -- Set Defaults - M.set_defaults() - -- Define Commands - M.define_commands() - -- Evaluate settings files - M.eval_settings_files() - -- Evaluate dependencies - M.eval_dependencies() - -- Evaluate neovide settings - M.eval_neovide() - -- Restore colorscheme - M.restore_colorscheme() - -- Set cursor icons - M.set_cursor_icons() - -- Load Stored Leader Key - vim.g.mapleader = M.leader -end - -return M +return { + "rootiest/rootiest.nvim", + config = true, +} diff --git a/lua/config/spellcheck.lua b/lua/config/spellcheck.lua deleted file mode 100644 index 0e9210a..0000000 --- a/lua/config/spellcheck.lua +++ /dev/null @@ -1,68 +0,0 @@ --- ----------------------------------------------------------------------------- --- ------------------------------- SpellCheck ---------------------------------- --- ----------------------------------------------------------------------------- - --- Define dictionary autocorrections -vim.keymap.set("ia", "teh", "the") -vim.keymap.set("ia", "accomodate", "accommodate") -vim.keymap.set("ia", "acommodate", "accommodate") -vim.keymap.set("ia", "aparent", "apparent") -vim.keymap.set("ia", "aparrent", "apparent") -vim.keymap.set("ia", "apparant", "apparent") -vim.keymap.set("ia", "apparrent", "apparent") -vim.keymap.set("ia", "aquire", "acquire") -vim.keymap.set("ia", "becuase", "because") -vim.keymap.set("ia", "cauhgt", "caught") -vim.keymap.set("ia", "choosen", "chosen") -vim.keymap.set("ia", "cieling", "ceiling") -vim.keymap.set("ia", "collegue", "teammate") -vim.keymap.set("ia", "concensus", "consensus") -vim.keymap.set("ia", "contians", "contains") -vim.keymap.set("ia", "cosnt", "const") -vim.keymap.set("ia", "dervied", "derived") -vim.keymap.set("ia", "fales", "false") -vim.keymap.set("ia", "fasle", "false") -vim.keymap.set("ia", "fitler", "filter") -vim.keymap.set("ia", "flase", "false") -vim.keymap.set("ia", "foward", "forward") -vim.keymap.set("ia", "frequecy", "frequency") -vim.keymap.set("ia", "gaurantee", "guarantee") -vim.keymap.set("ia", "guaratee", "guarantee") -vim.keymap.set("ia", "heigth", "height") -vim.keymap.set("ia", "heirarchy", "hierarchy") -vim.keymap.set("ia", "inclued", "include") -vim.keymap.set("ia", "interator", "iterator") -vim.keymap.set("ia", "intput", "input") -vim.keymap.set("ia", "invliad", "invalid") -vim.keymap.set("ia", "lenght", "length") -vim.keymap.set("ia", "liasion", "liaison") -vim.keymap.set("ia", "libary", "library") -vim.keymap.set("ia", "listner", "listener") -vim.keymap.set("ia", "looses:", "loses") -vim.keymap.set("ia", "looup", "lookup") -vim.keymap.set("ia", "manefist", "manifest") -vim.keymap.set("ia", "namesapce", "namespace") -vim.keymap.set("ia", "namespcae", "namespace") -vim.keymap.set("ia", "occassion", "occasion") -vim.keymap.set("ia", "occured", "occurred") -vim.keymap.set("ia", "ouptut", "output") -vim.keymap.set("ia", "ouput", "output") -vim.keymap.set("ia", "overide", "override") -vim.keymap.set("ia", "postion", "position") -vim.keymap.set("ia", "priviledge", "privilege") -vim.keymap.set("ia", "psuedo", "pseudo") -vim.keymap.set("ia", "recieve", "receive") -vim.keymap.set("ia", "refered", "referred") -vim.keymap.set("ia", "relevent", "relevant") -vim.keymap.set("ia", "retreive", "retrieve") -vim.keymap.set("ia", "sloder", "solder") -vim.keymap.set("ia", "sheild", "shield") -vim.keymap.set("ia", "garbarge", "garbage") -vim.keymap.set("ia", "oposite", "opposite") -vim.keymap.set("ia", "oportunity", "opportunity") -vim.keymap.set("ia", "retreive", "retrieve") -vim.keymap.set("ia", "vegitarien", "vegetarian") -vim.keymap.set("ia", "vegatarian", "vegetarian") -vim.keymap.set("ia", "vegeterian", "vegetarian") -vim.keymap.set("ia", "vegatarien", "vegetarian") -vim.keymap.set("ia", "vegeterien", "vegetarian") diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index bcfc678..178d75b 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -1,7 +1,7 @@ -- ----------------------------------------------------------------------------- -- --------------------------------- CODING ------------------------------------ -- ----------------------------------------------------------------------------- -local rootiest = require("config.rootiest") +local rootiest = require("rootiest") return { { -- Codeium diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua index bdb737f..fc95c06 100644 --- a/lua/plugins/dashboard.lua +++ b/lua/plugins/dashboard.lua @@ -2,62 +2,106 @@ -- -------------------------------- DASHBOARD ---------------------------------- -- ----------------------------------------------------------------------------- -return { -- Dashboard +return { + -- Dashboard "nvimdev/dashboard-nvim", opts = function() - if vim.fn.winheight(0) >= 80 and vim.fn.winwidth(0) >= 80 then - LOGO = table.concat( - vim.fn.readfile(vim.fn.stdpath("config") .. "/logo/rootiest.txt"), - "\n" - ) - elseif vim.fn.winheight(0) >= 48 and vim.fn.winwidth(0) >= 48 then - LOGO = table.concat( - vim.fn.readfile(vim.fn.stdpath("config") .. "/logo/nvim.txt"), - "\n" - ) - elseif vim.fn.winwidth(0) >= 100 then - LOGO = table.concat( - vim.fn.readfile(vim.fn.stdpath("config") .. "/logo/long.txt"), - "\n" - ) - elseif vim.fn.winwidth(0) >= 80 then - LOGO = table.concat( - vim.fn.readfile(vim.fn.stdpath("config") .. "/logo/tall.txt"), - "\n" - ) - elseif vim.fn.winwidth(0) >= 50 then - LOGO = table.concat( - vim.fn.readfile(vim.fn.stdpath("config") .. "/logo/small.txt"), - "\n" - ) + local logo_path = vim.fn.stdpath("config") .. "/logo/" + local height, width = vim.fn.winheight(0), vim.fn.winwidth(0) + local logo_file + + if height >= 80 and width >= 80 then + logo_file = "rootiest.txt" + elseif height >= 48 and width >= 48 then + logo_file = "nvim.txt" + elseif width >= 100 then + logo_file = "long.txt" + elseif width >= 80 then + logo_file = "tall.txt" + elseif width >= 50 then + logo_file = "small.txt" else - LOGO = table.concat( - vim.fn.readfile(vim.fn.stdpath("config") .. "/logo/tiny.txt"), - "\n" - ) + logo_file = "tiny.txt" end - LOGO = "\n\n" .. LOGO .. "\n\n" + + local logo_content = vim.fn.readfile(logo_path .. logo_file) + local LOGO = "\n\n" .. table.concat(logo_content, "\n") .. "\n\n" + local opts = { theme = "doom", - hide = { - statusline = false, - }, + hide = { statusline = false }, config = { header = vim.split(LOGO, "\n"), - -- stylua: ignore - center = { - { action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, - { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" }, - { action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" }, - { action = "LazyGit", desc = " LazyGit", icon = " ", key = "G" }, - { action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" }, - { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = 'LoadRemote', desc = " Remote Session", icon = "󰢹 ", key = "S" }, - { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, + center = { + { + action = "lua LazyVim.pick()()", + desc = " Find File", + icon = " ", + key = "f", }, + { + action = "ene | startinsert", + desc = " New File", + icon = " ", + key = "n", + }, + { + action = 'lua LazyVim.pick("oldfiles")()', + desc = " Recent Files", + icon = " ", + key = "r", + }, + { + action = 'lua LazyVim.pick("live_grep")()', + desc = " Find Text", + icon = " ", + key = "g", + }, + { + action = "LazyGit", + desc = " LazyGit", + icon = " ", + key = "G", + }, + { + action = "lua LazyVim.pick.config_files()()", + desc = " Config", + icon = " ", + key = "c", + }, + { + action = 'lua require("persistence").load()', + desc = " Restore Session", + icon = " ", + key = "s", + }, + { + action = "LoadRemote", + desc = " Remote Session", + icon = "󰢹 ", + key = "S", + }, + { + action = "LazyExtras", + desc = " Lazy Extras", + icon = " ", + key = "x", + }, + { + action = "Lazy", + desc = " Lazy", + icon = "󰒲 ", + key = "l", + }, + { + action = function() + vim.api.nvim_input("qa") + end, + desc = " Quit", + icon = " ", + key = "q", + }, + }, footer = function() local stats = require("lazy").stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) @@ -73,11 +117,13 @@ return { -- Dashboard end, }, } + for _, button in ipairs(opts.config.center) do button.desc = button.desc .. string.rep(" ", 43 - #button.desc) button.key_format = " %s" end - -- open dashboard after closing lazy + + -- Open dashboard after closing lazy if vim.o.filetype == "lazy" then vim.api.nvim_create_autocmd("WinClosed", { pattern = tostring(vim.api.nvim_get_current_win()), @@ -89,6 +135,7 @@ return { -- Dashboard end, }) end + return opts end, } diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index bfbc962..51bf12f 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,7 +1,7 @@ -- ----------------------------------------------------------------------------- -- --------------------------------- EDITOR ------------------------------------ -- ----------------------------------------------------------------------------- -local rootiest = require("config.rootiest") +local rootiest = require("rootiest") return { { -- Edgy diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua index fec0887..07efe28 100644 --- a/lua/plugins/terminal.lua +++ b/lua/plugins/terminal.lua @@ -96,7 +96,6 @@ return { local content = vim.fn.readfile(useimage_file)[1] or "" content = content:lower():gsub("%s+", "") -- convert to lowercase and remove whitespace local enable_values = { ["true"] = true, ["1"] = true, ["yes"] = true } - if enable_values[content] then local wterm = os.getenv("TERM_PROGRAM") local kterm = os.getenv("TERM") or "" diff --git a/lua/plugins/themes.lua b/lua/plugins/themes.lua index f74ecf5..113b551 100644 --- a/lua/plugins/themes.lua +++ b/lua/plugins/themes.lua @@ -1,7 +1,7 @@ -- ----------------------------------------------------------------------------- -- --------------------------------- THEMES ------------------------------------ -- ----------------------------------------------------------------------------- -local rootiest = require("config.rootiest") +local rootiest = require("rootiest") return { -- ----------------------- Themes --------------------------