diff --git a/init.lua b/init.lua index 66614ec..b0faf59 100644 --- a/init.lua +++ b/init.lua @@ -53,3 +53,5 @@ -- ---------------------------------- LAZY ------------------------------------- -- Load Lazy package manager and plugins require("config.lazy") + +require("config.rootiest").setup() diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index b1b3e2d..693604d 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -1,42 +1,6 @@ -- ----------------------------------------------------------------------------- -- -------------------------------- AUTOCMDS ----------------------------------- -- ----------------------------------------------------------------------------- --- Autosave Colorscheme --- When the colorscheme changes, store the name in .colorscheme -vim.api.nvim_create_autocmd("ColorScheme", { - desc = "Store colorscheme name", - callback = function() - print("colorscheme:", vim.g.colors_name) - vim.fn.writefile( - { vim.g.colors_name }, - vim.fn.stdpath("config") .. "/.colorscheme" - ) - end, -}) - --- 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, -}) -- GIT CONFLICT MARKERS -- if there are conflicts, jump to first conflict, highlight conflict markers, diff --git a/lua/config/autospell.lua b/lua/config/autospell.lua new file mode 100644 index 0000000..0e9210a --- /dev/null +++ b/lua/config/autospell.lua @@ -0,0 +1,68 @@ +-- ----------------------------------------------------------------------------- +-- ------------------------------- 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/config/keymaps.lua b/lua/config/keymaps.lua index f4b696f..76e220e 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("rootiest") +local rootiest = require("config.rootiest") local wk = require("which-key") wk.add({ diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 32cd881..8b1d844 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -20,7 +20,6 @@ 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 new file mode 100644 index 0000000..5ce9f53 --- /dev/null +++ b/lua/config/neovide.lua @@ -0,0 +1,45 @@ +-- ----------------------------------------------------------------------------- +-- --------------------------------- 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/options.lua b/lua/config/options.lua index 8001014..31fa8ac 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -7,3 +7,9 @@ vim.g.loaded_perl_provider = 0 -- Prefer basedpyright vim.g.lazyvim_python_lsp = "basedpyright" +-- --------------------------------- ROOTIEST ----------------------------------- +vim.g.aitool = "codeium" +vim.g.usewakatime = true +vim.g.usehardtime = false +vim.g.useimage = true +vim.o.background = "dark" diff --git a/lua/config/rootiest.lua b/lua/config/rootiest.lua index c4f41cc..84ff435 100644 --- a/lua/config/rootiest.lua +++ b/lua/config/rootiest.lua @@ -1,4 +1,130 @@ -return { - "rootiest/rootiest.nvim", - config = true, -} +local M = {} + +local precog_first_time = true + +-- Yank line without leading/trailing whitespace +function M.yank_line() + vim.api.nvim_feedkeys("_v$hy$", "n", true) +end + +-- Check if the terminal is Kitty +function M.using_kitty() + local term = os.getenv("TERM") or "" + return term:find("kitty") ~= nil +end + +-- Toggle the precognition plugin +function M.toggle_precognition() + if pcall(require, "precognition") then + local precognition = require("precognition") + if precog_first_time then + precognition.toggle() + precognition.toggle() -- Call toggle twice + precog_first_time = false + else + precognition.toggle() -- Call toggle once + end + else + vim.api.nvim_err_writeln("precognition plugin is not installed") + end +end + +-- Toggle Hardtime and Precognition +function M.toggle_hardmode() + if pcall(require, "hardtime") then + local hardtime = require("hardtime") + hardtime.toggle() + M.toggle_precognition() + else + vim.api.nvim_err_writeln("hardtime plugin is not installed") + end +end + +-- Toggle LazyGit terminal +function M.toggle_lazygit_term() + if pcall(require, "toggleterm.terminal") then + local Terminal = require("toggleterm.terminal").Terminal + local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) + lazygit:toggle() + else + vim.api.nvim_err_writeln("toggleterm plugin is not installed") + end +end + +-- Load remote-nvim plugin +function M.load_remote() + if pcall(require, "remote-nvim") then + ---@diagnostic disable-next-line: missing-parameter + require("remote-nvim").setup() + vim.cmd("RemoteStart") + else + vim.api.nvim_err_writeln("remote-nvim plugin is not installed") + end +end + +-- Set cursor icons +function M.set_cursor_icons() + 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_c", { text = "" }) + vim.fn.sign_define("smoothcursor_R", { text = "󰊄" }) +end + +-- Evaluate dependencies and print warnings if needed +function M.eval_dependencies() + local function should_suppress_warnings() + return false + end + + 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 + + if not should_suppress_warnings() then + local executables = + { "lazygit", "gh", "rg", "fzf", "fd", "git", "luarocks" } + for _, executable in ipairs(executables) do + check_executable(executable) + end + end +end + +-- Evaluate Neovide settings +function M.eval_neovide() + if vim.g.neovide then + require("config.neovide") + end +end + +-- Define autocorrections +function M.define_autocorrections() + require("config.autospell") +end + +-- Define user commands +function M.define_commands() + vim.api.nvim_create_user_command("Q", function() + vim.cmd.qall() + end, { force = true, desc = "Close all buffers" }) + + vim.api.nvim_create_user_command("YankLine", function() + M.yank_line() + end, { force = true, desc = "Yank line without leading whitespace" }) +end + +function M.setup() + M.eval_dependencies() + M.eval_neovide() + M.define_autocorrections() + M.define_commands() +end + +return M diff --git a/lua/plugins/astral.lua b/lua/plugins/astral.lua new file mode 100644 index 0000000..4575cbe --- /dev/null +++ b/lua/plugins/astral.lua @@ -0,0 +1,5 @@ +return { + "rootiest/astral.nvim", + version = "*", + --opts = { restore_colors = true }, +} diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index 178d75b..53ef7f7 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -1,25 +1,24 @@ -- ----------------------------------------------------------------------------- -- --------------------------------- CODING ------------------------------------ -- ----------------------------------------------------------------------------- -local rootiest = require("rootiest") return { { -- Codeium import = "lazyvim.plugins.extras.coding.codeium", cond = function() - return rootiest.using_aitool("codeium") + return vim.g.aitool == "codeium" end, }, { -- Copilot import = "lazyvim.plugins.extras.coding.copilot", cond = function() - return rootiest.using_aitool("copilot") + return vim.g.aitool == "copilot" end, }, { -- Tabnine import = "lazyvim.plugins.extras.coding.tabnine", cond = function() - return rootiest.using_aitool("tabnine") + return vim.g.aitool == "tabnine" end, }, { -- Minuet-AI @@ -29,7 +28,7 @@ return { require("minuet").setup({ provider = "openai" }) end, cond = function() - return rootiest.using_aitool("minuet") + return vim.g.aitool == "minuet" end, }, { -- Yanky diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 51bf12f..5e6ece2 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,8 +1,6 @@ -- ----------------------------------------------------------------------------- -- --------------------------------- EDITOR ------------------------------------ -- ----------------------------------------------------------------------------- -local rootiest = require("rootiest") - return { { -- Edgy import = "lazyvim.plugins.extras.ui.edgy", @@ -30,6 +28,16 @@ return { }, }, }, + { + "lukas-reineke/indent-blankline.nvim", + opts = { + scope = { show_start = true, show_end = true }, + indent = { + char = "⋯", + tab_char = "⋯", + }, + }, + }, { -- Outline import = "lazyvim.plugins.extras.editor.outline", }, @@ -169,93 +177,6 @@ return { config = function() ---@diagnostic disable-next-line: missing-parameter require("smoothcursor").setup() - -- 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, - }, - { -- Hlchunk - "shellRaining/hlchunk.nvim", - event = "BufEnter", - config = function() - local cb = function() - if vim.g.colors_name == "tokyonight" then - return "#806d9c" - elseif vim.g.colors_name:find("catppuccin") then - local catpalette = require("catppuccin.palettes").get_palette() - return catpalette.teal - elseif vim.g.colors_name == "monochrome" or "github_dark" then - return "#CCCCCC" - elseif vim.g.colors_name == "gruvbox" then - return "#a9b665" - elseif vim.g.colors_name == "dracula" or "eldritch" then - return "#50fa7b" - elseif vim.g.colors_name == "onedark" or "nightfox" then - return "#98C379" - elseif vim.g.colors_name == "nord" then - return "#81A1C1" - elseif vim.g.colors_name == "kanagawa" then - return "#73C8AD" - elseif vim.g.colors_name == "everforest" then - return "#8FBCBB" - elseif vim.g.colors_name == "github_light" or "paper" then - return "#3f3f5a" - elseif vim.g.colors_name == "neofusion" then - return "#420ADD" - else - return "#7581FF" - end - end - local common_config = { - chunk = { - style = { - { fg = cb }, - }, - enable = true, - }, - indent = { - enable = true, - use_treesitter = true, - chars = { - "․․", - "⁚⁚", - "⁖⁖", - "⁘⁘", - "⁙⁙", - "󱗿󱗿", - "󱗽󱗽", - "󱗼󱗼", - }, - }, - } - if vim.o.background == "dark" then - common_config.indent.style = { - { fg = "#434437" }, - { fg = "#2f4440" }, - { fg = "#433054" }, - { fg = "#284251" }, - { fg = "#3e4451" }, - { fg = "#565c64" }, - { fg = "#6b737f" }, - { fg = "#848a91" }, - } - else - common_config.indent.style = { - { fg = "#d0b0b0" }, - { fg = "#b0b0d0" }, - { fg = "#b0d0b0" }, - { fg = "#a0a0a0" }, - { fg = "#c0c0c0" }, - { fg = "#e0e0e0" }, - { fg = "#f0f0f0" }, - { fg = "#ffffff" }, - } - end - require("hlchunk").setup(common_config) end, }, } diff --git a/lua/plugins/languages.lua b/lua/plugins/languages.lua index 2244a90..1ad696e 100644 --- a/lua/plugins/languages.lua +++ b/lua/plugins/languages.lua @@ -33,11 +33,11 @@ return { { -- Java import = "lazyvim.plugins.extras.lang.java", }, - { -- Markdown-Preview - "iamcco/markdown-preview.nvim", - build = "cd app && yarn install", - init = function() - vim.g.mkdp_filetypes = { "markdown" } - end, - }, + -- { -- Markdown-Preview + -- "iamcco/markdown-preview.nvim", + -- build = "cd app && yarn install", + -- init = function() + -- vim.g.mkdp_filetypes = { "markdown" } + -- end, + -- }, } diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua index 07efe28..dad822f 100644 --- a/lua/plugins/terminal.lua +++ b/lua/plugins/terminal.lua @@ -90,25 +90,7 @@ return { config = function() require("image").setup() end, - cond = function() - local function is_useimage_enabled() - local useimage_file = vim.fn.stdpath("config") .. "/.useimage" - 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 "" - if wterm and wterm:find("WezTerm") then - return true -- Using WezTerm - else - return kterm:find("kitty") ~= nil -- Using Kitty - end - end - - return false - end - end, + cond = vim.g.useimage and not vim.g.neovide, }, { -- WezTerm "willothy/wezterm.nvim", diff --git a/lua/plugins/themes.lua b/lua/plugins/themes.lua index 113b551..2569273 100644 --- a/lua/plugins/themes.lua +++ b/lua/plugins/themes.lua @@ -1,7 +1,7 @@ -- ----------------------------------------------------------------------------- -- --------------------------------- THEMES ------------------------------------ -- ----------------------------------------------------------------------------- -local rootiest = require("rootiest") +local astral = require("astral") return { -- ----------------------- Themes -------------------------- @@ -12,6 +12,13 @@ return { { -- Catppuccin "catppuccin/nvim", lazy = false, -- Override + integrations = { + indent_blankline = { + enabled = true, + scope_color = "lavender", + colored_indent_levels = false, + }, + }, }, { -- Ayu "Shatur/neovim-ayu", @@ -74,13 +81,13 @@ return { set_dark_mode = function() vim.o.background = "dark" vim.cmd.colorscheme( - rootiest.colortheme or "catppuccin-frappe" or "tokyonight" + astral.colortheme or "catppuccin-frappe" or "tokyonight" ) end, set_light_mode = function() vim.o.background = "light" vim.cmd.colorscheme( - rootiest.colortheme or "catppuccin-latte" or "tokyonight-day" + astral.colortheme or "catppuccin-latte" or "tokyonight-day" ) end, }, diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua index 7ba47a5..167b850 100644 --- a/lua/plugins/util.lua +++ b/lua/plugins/util.lua @@ -21,20 +21,7 @@ return { }, { -- Wakatime "wakatime/vim-wakatime", - cond = function() - local function is_wakatime_enabled() - local wakatime_file = vim.fn.stdpath("config") .. "/.wakatime" - local content = vim.fn.readfile(wakatime_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 - return { enabled = true } - else - return { enabled = false } - end - end - return is_wakatime_enabled() - end, + cond = vim.g.usewakatime, }, { -- Link following "chrishrb/gx.nvim", @@ -129,18 +116,7 @@ return { "m4xshen/hardtime.nvim", dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, opts = function() - local function is_hardtime_enabled() - local hardtime_file = vim.fn.stdpath("config") .. "/.hardtime" - local content = vim.fn.readfile(hardtime_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 - return { enabled = true } - else - return { enabled = false } - end - end - return is_hardtime_enabled() + return { enabled = vim.g.usehardtime } end, }, { -- GitLinker