diff --git a/lua/config/options.lua b/lua/config/options.lua index bb164db..5d51c38 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -35,14 +35,14 @@ vim.g.useimage = true ---@type boolean Options: vim.g.ignore_no_lazy = false ---@type boolean Options: -- Enable codesnap for code screenshots vim.g.codesnap = true ---@type boolean Options: +-- Enable encouraging feedback +vim.g.encourage_me = true ---@type boolean Options: -- Enable Auto-hiding cursorline vim.g.auto_cursorline = true ---@type boolean Options: -- Enable Auto-save vim.g.auto_save = true ---@type boolean Options: -- Animate blinky cursor vim.g.blinky = true ---@type boolean Options: --- Use Rootiest cmd window instead of cmdline -vim.g.rootiest_cmd = false ---@type boolean Options: -- Use experimental cmp performance fork vim.g.cmp_performance_enabled = true ---@type boolean Options: -- Use dev mode for rootiest plugins @@ -118,5 +118,6 @@ vim.g.completion_round_borders_enabled = true ---@type boolean Options: cxc", + "ChatGPT", + desc = "ChatGPT", + }, + { + "cxe", + "ChatGPTEditWithInstruction", + desc = "Edit with instruction", + mode = { "n", "v" }, + }, + { + "cxg", + "ChatGPTRun grammar_correction", + desc = "Grammar Correction", + mode = { "n", "v" }, + }, + { + "cxt", + "ChatGPTRun translate", + desc = "Translate", + mode = { "n", "v" }, + }, + { + "cxk", + "ChatGPTRun keywords", + desc = "Keywords", + mode = { "n", "v" }, + }, + { + "cxd", + "ChatGPTRun docstring", + desc = "Docstring", + mode = { "n", "v" }, + }, + { + "cxa", + "ChatGPTRun add_tests", + desc = "Add Tests", + mode = { "n", "v" }, + }, + { + "cxo", + "ChatGPTRun optimize_code", + desc = "Optimize Code", + mode = { "n", "v" }, + }, + { + "cxs", + "ChatGPTRun summarize", + desc = "Summarize", + mode = { "n", "v" }, + }, + { + "cxf", + "ChatGPTRun fix_bugs", + desc = "Fix Bugs", + mode = { "n", "v" }, + }, + { + "cxr", + "ChatGPTRun explain_code", + desc = "Explain Code", + mode = { "n", "v" }, + }, + { + "cxr", + "ChatGPTRun roxygen_edit", + desc = "Roxygen Edit", + mode = { "n", "v" }, + }, + { + "cxl", + "ChatGPTRun code_readability_analysis", + desc = "Code Readability Analysis", + mode = { "n", "v" }, + }, + }, +} + M.codesnap = { { -- Save selected code snapshot into clipboard "cy", @@ -69,75 +157,83 @@ M.flash = { } M.minimap = { - { -- Toggle minimap - "nt", - "Neominimap toggle", - desc = "Toggle minimap", - }, - { -- Enable minimap - "no", - "Neominimap on", - desc = "Enable minimap", - }, - { -- Disable minimap - "nc", - "Neominimap off", - desc = "Disable minimap", - }, - { -- Refresh minimap - "nf", - "Neominimap focus", - desc = "Focus on minimap", - }, - { -- Unfocus minimap - "nu", - "Neominimap unfocus", - desc = "Unfocus minimap", - }, - { -- Toggle focus - "ns", - "Neominimap toggleFocus", - desc = "Toggle focus on minimap", - }, - { -- Toggle minimap for current window - "nwt", - "Neominimap winToggle", - desc = "Toggle minimap for current window", - }, - { -- Refresh minimap for current window - "nwr", - "Neominimap winRefresh", - desc = "Refresh minimap for current window", - }, - { -- Enable minimap for current window - "nwo", - "Neominimap winOn", - desc = "Enable minimap for current window", - }, - { -- Disable minimap for current window - "nwc", - "Neominimap winOff", - desc = "Disable minimap for current window", - }, - { -- Toggle minimap for current buffer - "nbt", - "Neominimap bufToggle", - desc = "Toggle minimap for current buffer", - }, - { -- Refresh minimap for current buffer - "nbr", - "Neominimap bufRefresh", - desc = "Refresh minimap for current buffer", - }, - { -- Enable minimap for current buffer - "nbo", - "Neominimap bufOn", - desc = "Enable minimap for current buffer", - }, - { -- Disable minimap for current buffer - "nbc", - "Neominimap bufOff", - desc = "Disable minimap for current buffer", + func = function() + -- Add NeoMiniMap menu + require("data.func").add_keymap(M.group.minimap) + -- Add NeoMiniMap keys + return M.minimap.keys + end, + keys = { + { -- Toggle minimap + "nt", + "Neominimap toggle", + desc = "Toggle minimap", + }, + { -- Enable minimap + "no", + "Neominimap on", + desc = "Enable minimap", + }, + { -- Disable minimap + "nc", + "Neominimap off", + desc = "Disable minimap", + }, + { -- Refresh minimap + "nf", + "Neominimap focus", + desc = "Focus on minimap", + }, + { -- Unfocus minimap + "nu", + "Neominimap unfocus", + desc = "Unfocus minimap", + }, + { -- Toggle focus + "ns", + "Neominimap toggleFocus", + desc = "Toggle focus on minimap", + }, + { -- Toggle minimap for current window + "nwt", + "Neominimap winToggle", + desc = "Toggle minimap for current window", + }, + { -- Refresh minimap for current window + "nwr", + "Neominimap winRefresh", + desc = "Refresh minimap for current window", + }, + { -- Enable minimap for current window + "nwo", + "Neominimap winOn", + desc = "Enable minimap for current window", + }, + { -- Disable minimap for current window + "nwc", + "Neominimap winOff", + desc = "Disable minimap for current window", + }, + { -- Toggle minimap for current buffer + "nbt", + "Neominimap bufToggle", + desc = "Toggle minimap for current buffer", + }, + { -- Refresh minimap for current buffer + "nbr", + "Neominimap bufRefresh", + desc = "Refresh minimap for current buffer", + }, + { -- Enable minimap for current buffer + "nbo", + "Neominimap bufOn", + desc = "Enable minimap for current buffer", + }, + { -- Disable minimap for current buffer + "nbc", + "Neominimap bufOff", + desc = "Disable minimap for current buffer", + }, }, } @@ -244,44 +340,257 @@ M.gitgraph = { } M.gist = { - { -- Create Gist - "gnc", - "GistCreate", - desc = "Create Gist", - mode = { "n", "x" }, - }, - { -- Find Gists - "gnf", - "GistList", - desc = "Find Gists", + func = function() + -- Add gists menu + require("data.func").add_keymap(M.group.gist) + -- Add gists keys + return M.gist.keys + end, + keys = { + { -- Create Gist + "gnc", + "GistCreate", + desc = "Create Gist", + mode = { "n", "x" }, + }, + { -- Find Gists + "gnf", + "GistList", + desc = "Find Gists", + }, }, } -M.groups = { - { -- Gists menu +M.undotree = function() + require("data.func").add_keymap( + "uu", + "UndotreeToggle", + "Toggle UndoTree" + ) +end + +M.gp = { + func = function() + -- Use which-key directly + if pcall(require, "which-key") then + require("which-key").add(M.gp.keys) + end + end, + keys = { + -- VISUAL mode mappings + -- s, x, v modes are handled the same way by which_key + { + mode = { "v" }, + nowait = true, + remap = false, + { + "", + ":'<,'>GpChatNew tabnew", + desc = "ChatNew tabnew", + }, + { + "", + ":'<,'>GpChatNew vsplit", + desc = "ChatNew vsplit", + }, + { + "", + ":'<,'>GpChatNew split", + desc = "ChatNew split", + }, + { "a", ":'<,'>GpAppend", desc = "Visual Append (after)" }, + { + "b", + ":'<,'>GpPrepend", + desc = "Visual Prepend (before)", + }, + { "c", ":'<,'>GpChatNew", desc = "Visual Chat New" }, + { "g", group = "generate into new .." }, + { "ge", ":'<,'>GpEnew", desc = "Visual GpEnew" }, + { "gn", ":'<,'>GpNew", desc = "Visual GpNew" }, + { "gp", ":'<,'>GpPopup", desc = "Visual Popup" }, + { "gt", ":'<,'>GpTabnew", desc = "Visual GpTabnew" }, + { "gv", ":'<,'>GpVnew", desc = "Visual GpVnew" }, + { "i", ":'<,'>GpImplement", desc = "Implement selection" }, + { "n", "GpNextAgent", desc = "Next Agent" }, + { "p", ":'<,'>GpChatPaste", desc = "Visual Chat Paste" }, + { "r", ":'<,'>GpRewrite", desc = "Visual Rewrite" }, + { "s", "GpStop", desc = "GpStop" }, + { "t", ":'<,'>GpChatToggle", desc = "Visual Toggle Chat" }, + { "w", group = "Whisper" }, + { "wa", ":'<,'>GpWhisperAppend", desc = "Whisper Append" }, + { + "wb", + ":'<,'>GpWhisperPrepend", + desc = "Whisper Prepend", + }, + { "we", ":'<,'>GpWhisperEnew", desc = "Whisper Enew" }, + { "wn", ":'<,'>GpWhisperNew", desc = "Whisper New" }, + { "wp", ":'<,'>GpWhisperPopup", desc = "Whisper Popup" }, + { + "wr", + ":'<,'>GpWhisperRewrite", + desc = "Whisper Rewrite", + }, + { "wt", ":'<,'>GpWhisperTabnew", desc = "Whisper Tabnew" }, + { "wv", ":'<,'>GpWhisperVnew", desc = "Whisper Vnew" }, + { "ww", ":'<,'>GpWhisper", desc = "Whisper" }, + { "x", ":'<,'>GpContext", desc = "Visual GpContext" }, + }, + + -- NORMAL mode mappings + { + mode = { "n" }, + nowait = true, + remap = false, + { "", "GpChatNew tabnew", desc = "New Chat tabnew" }, + { "", "GpChatNew vsplit", desc = "New Chat vsplit" }, + { "", "GpChatNew split", desc = "New Chat split" }, + { "a", "GpAppend", desc = "Append (after)" }, + { "b", "GpPrepend", desc = "Prepend (before)" }, + { "c", "GpChatNew", desc = "New Chat" }, + { "f", "GpChatFinder", desc = "Chat Finder" }, + { "g", group = "generate into new .." }, + { "ge", "GpEnew", desc = "GpEnew" }, + { "gn", "GpNew", desc = "GpNew" }, + { "gp", "GpPopup", desc = "Popup" }, + { "gt", "GpTabnew", desc = "GpTabnew" }, + { "gv", "GpVnew", desc = "GpVnew" }, + { "n", "GpNextAgent", desc = "Next Agent" }, + { "r", "GpRewrite", desc = "Inline Rewrite" }, + { "s", "GpStop", desc = "GpStop" }, + { "t", "GpChatToggle", desc = "Toggle Chat" }, + { "w", group = "Whisper" }, + { + "wa", + "GpWhisperAppend", + desc = "Whisper Append (after)", + }, + { + "wb", + "GpWhisperPrepend", + desc = "Whisper Prepend (before)", + }, + { "we", "GpWhisperEnew", desc = "Whisper Enew" }, + { "wn", "GpWhisperNew", desc = "Whisper New" }, + { "wp", "GpWhisperPopup", desc = "Whisper Popup" }, + { + "wr", + "GpWhisperRewrite", + desc = "Whisper Inline Rewrite", + }, + { "wt", "GpWhisperTabnew", desc = "Whisper Tabnew" }, + { "wv", "GpWhisperVnew", desc = "Whisper Vnew" }, + { "ww", "GpWhisper", desc = "Whisper" }, + { "x", "GpContext", desc = "Toggle GpContext" }, + }, + + -- INSERT mode mappings + { + mode = { "i" }, + nowait = true, + remap = false, + { "", "GpChatNew tabnew", desc = "New Chat tabnew" }, + { "", "GpChatNew vsplit", desc = "New Chat vsplit" }, + { "", "GpChatNew split", desc = "New Chat split" }, + { "a", "GpAppend", desc = "Append (after)" }, + { "b", "GpPrepend", desc = "Prepend (before)" }, + { "c", "GpChatNew", desc = "New Chat" }, + { "f", "GpChatFinder", desc = "Chat Finder" }, + { "g", group = "generate into new .." }, + { "ge", "GpEnew", desc = "GpEnew" }, + { "gn", "GpNew", desc = "GpNew" }, + { "gp", "GpPopup", desc = "Popup" }, + { "gt", "GpTabnew", desc = "GpTabnew" }, + { "gv", "GpVnew", desc = "GpVnew" }, + { "n", "GpNextAgent", desc = "Next Agent" }, + { "r", "GpRewrite", desc = "Inline Rewrite" }, + { "s", "GpStop", desc = "GpStop" }, + { "t", "GpChatToggle", desc = "Toggle Chat" }, + { "w", group = "Whisper" }, + { + "wa", + "GpWhisperAppend", + desc = "Whisper Append (after)", + }, + { + "wb", + "GpWhisperPrepend", + desc = "Whisper Prepend (before)", + }, + { "we", "GpWhisperEnew", desc = "Whisper Enew" }, + { "wn", "GpWhisperNew", desc = "Whisper New" }, + { "wp", "GpWhisperPopup", desc = "Whisper Popup" }, + { + "wr", + "GpWhisperRewrite", + desc = "Whisper Inline Rewrite", + }, + { "wt", "GpWhisperTabnew", desc = "Whisper Tabnew" }, + { "wv", "GpWhisperVnew", desc = "Whisper Vnew" }, + { "ww", "GpWhisper", desc = "Whisper" }, + { "x", "GpContext", desc = "Toggle GpContext" }, + }, + }, +} + +M.group = { + chatgpt = { -- ChatGPT + lhs = "cx", + group = "ChatGPT", + icon = { icon = "", color = "blue" }, + }, + gist = { -- Gists menu lhs = "gn", group = "Gists", icon = { icon = "", color = "orange" }, }, + minimap = { -- MiniMap menu + lhs = "n", + group = "MiniMap", + icon = { icon = "", color = "green" }, + }, + nvimup = { -- Neovim Updater menu + lhs = "qu", + group = "Neovim Updater", + icon = { icon = "", color = "red" }, + }, +} + +M.groups = { { -- Lazy menu lhs = "l", group = "Lazy", icon = { icon = "󰒲", color = "red" }, }, - { -- MiniMap menu - lhs = "n", - group = "MiniMap", - icon = { icon = "", color = "green" }, +} + +M.nvimup = { + { + "quU", + ":UpdateNeovim", + desc = "Update Neovim", }, - { -- Code action menu - lhs = "C", - group = "CodeActions", - icon = { icon = "", color = "yellow" }, + { + "quD", + function() + require("nvim_updater").update_neovim({ build_type = "Debug" }) + end, + desc = "Debug Build Neovim", }, - { -- Neovim Updater menu - lhs = "qu", - group = "Neovim Updater", - icon = { icon = "", color = "red" }, + { + "quR", + function() + require("nvim_updater").update_neovim({ build_type = "Release" }) + end, + desc = "Release Build Neovim", + }, + { + "quC", + function() + require("nvim_updater").remove_source_dir() + end, + desc = "Clean Neovim Source", }, } @@ -725,9 +1034,8 @@ M.telescope = { sources = { "emoji", "kaomoji", "gitmoji", "nerd", "math" }, }) end, - "i", - desc = "Pick Icon", + mode = "i", }, }, toggleterm = { diff --git a/lua/data/types.lua b/lua/data/types.lua index cbe5705..900f3e9 100644 --- a/lua/data/types.lua +++ b/lua/data/types.lua @@ -165,6 +165,14 @@ M.border = { end, } +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Cursor Styles ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +M.cursors = { + smooth = "", + block = "█", + line = "⎸", + underline = "_", +} + -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Type tables ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --- General exclusion list for buffers and filetypes @@ -262,6 +270,51 @@ M.bufferline = { }, } +--- CodeSnap configuration options +M.codesnap = { + save_path = "~/Pictures/Screenshots/", + has_breadcrumbs = true, + show_workspace = true, + bg_theme = "default", + watermark = "Rootiest Snippets", + code_font_family = "Iosevka NF", + code_font_size = 12, +} + +--- Flash configuration options +M.flash = { + modes = { char = { jump_labels = true } }, +} + +--- Smart-Scrolloff configuration options +M.smartscrolloff = { scrolloff_percentage = 0.25 } + +--- AutoCursorline configuration options +M.autocursorline = { wait_ms = 2000 } + +--- SmoothCursor +M.smoothcursor = { + cursor = M.cursors.smooth, +} + +--- Suda configuration options +M.suda = function() + vim.g.suda_smart_edit = 1 + vim.cmd("let g:suda#prompt = '  Enter Sudo Password  '") +end + +--- Autosave configuration options +M.autosave = { + execution_message = { + enabled = false, + }, +} + +--- Kulala plugin types +M.kulala = { + ft = { "http", "https", "ftp", "ftps" }, +} + --- LazyVim configuration options M.lazyvim = { opts = { @@ -455,6 +508,61 @@ M.gitblame = { }, } +--- ChatGPT configuration options +M.chatgpt = { + openai_params = { + model = "gpt-4o-mini", + }, +} + +-- GP ChatBot configuration options +M.gp = function() + require("which-key").setup({ + triggers = "", + mode = M.all_modes, + }) + return { + hooks = { + -- example of adding command which writes unit tests for the selected code + UnitTests = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please respond by writing table driven unit tests for the code above." + local agent = gp.get_command_agent() + gp.Prompt(params, gp.Target.vnew, agent, template) + end, + -- example of adding command which explains the selected code + Explain = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please respond by explaining the code above." + local agent = gp.get_chat_agent() + gp.Prompt(params, gp.Target.popup, agent, template) + end, + -- example of usig enew as a function specifying type for the new buffer + CodeReview = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please analyze for code smells and suggest improvements." + local agent = gp.get_chat_agent() + gp.Prompt(params, gp.Target.enew("markdown"), agent, template) + end, + -- example of adding command which opens new chat dedicated for translation + Translator = function(gp, params) + local chat_system_prompt = + "You are a Translator, please translate between English and Chinese." + gp.cmd.ChatNew(params, chat_system_prompt) + end, + -- example of making :%GpChatNew a dedicated command which + -- opens new chat with the entire current buffer as a context + BufferChatNew = function(gp, _) + -- call GpChatNew command in range mode on whole buffer + vim.api.nvim_command("%" .. gp.config.cmd_prefix .. "ChatNew") + end, + }, + } +end + --- Telescope configuration options M.telescope = { cmdline = { @@ -541,51 +649,68 @@ M.whichkey = { --- Git-Graph plugin options M.gitgraph = { - --- Git-graph symbols check for kitty - symbols = function() - if require("data.func").is_kitty() then - return { - merge_commit = "", - commit = "", - merge_commit_end = "", - commit_end = "", + opts = { + -- GitGraph Hooks + hooks = { + -- Check diff of a commit + on_select_commit = function(commit) + vim.notify("DiffviewOpen " .. commit.hash .. "^!") + vim.cmd(":DiffviewOpen " .. commit.hash .. "^!") + end, + -- Check diff from commit a -> commit b + on_select_range_commit = function(from, to) + vim.notify("DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + vim.cmd(":DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + end, + }, + --- Git-graph symbols check for kitty + symbols = function() + if require("data.func").is_kitty() then + return { + merge_commit = "", + commit = "", + merge_commit_end = "", + commit_end = "", - -- Advanced symbols - GVER = "", - GHOR = "", - GCLD = "", - GCRD = "╭", - GCLU = "", - GCRU = "", - GLRU = "", - GLRD = "", - GLUD = "", - GRUD = "", - GFORKU = "", - GFORKD = "", - GRUDCD = "", - GRUDCU = "", - GLUDCD = "", - GLUDCU = "", - GLRDCL = "", - GLRDCR = "", - GLRUCL = "", - GLRUCR = "", - } - else - -- Fallback - return { - merge_commit = "", - commit = "", - merge_commit_end = "", - commit_end = "", - } - end - end, - -- Git graph timestamp style - timestamp = "%H:%M:%S %d-%m-%Y", - -- Git graph fields to display - fields = { "hash", "timestamp", "author", "branch_name", "tag" }, + -- Advanced symbols + GVER = "", + GHOR = "", + GCLD = "", + GCRD = "╭", + GCLU = "", + GCRU = "", + GLRU = "", + GLRD = "", + GLUD = "", + GRUD = "", + GFORKU = "", + GFORKD = "", + GRUDCD = "", + GRUDCU = "", + GLUDCD = "", + GLUDCU = "", + GLRDCL = "", + GLRDCR = "", + GLRUCL = "", + GLRUCR = "", + } + else + -- Fallback + return { + merge_commit = "", + commit = "", + merge_commit_end = "", + commit_end = "", + } + end + end, + format = { + -- Git graph timestamp style + timestamp = "%H:%M:%S %d-%m-%Y", + -- Git graph fields to display + fields = { "hash", "timestamp", "author", "branch_name", "tag" }, + }, + }, } --- Highlights module options @@ -611,8 +736,18 @@ M.ibl = { "󰎼", "󰽽", }, + solid = { + "▏", + "▎", + "▍", + "▌", + "▋", + "▊", + "▉", + "█", + }, none = { " " }, - basic = { "󰇘" }, + baric = { "󰇘" }, }, scope_char = { light = { "" }, @@ -624,6 +759,122 @@ M.ibl = { arrow = { "" }, tab = { "󰌒" }, }, + tab_char = { + fancy = { + "󰌒", + "󰌓", + "󰌔", + "󰌕", + "󰌖", + "󰌗", + "󰌘", + "󰌙", + "󰌚", + "󰌛", + }, + none = { " " }, + basic = { "" }, + simple = { "" }, + arrow = { "" }, + tab = { "󰌒" }, + mini = { "" }, + }, +} + +--- Mini.Indentscope configuration options +M.miniindentscope = { + symbol = M.ibl.scope_char.hard[1], + options = { try_as_border = true, border = "both" }, +} + +--- Navic Icons +M.navic = { + icons = { + classic = { + File = "󰈙 ", + Module = " ", + Namespace = "󰌗 ", + Package = " ", + Class = "󰌗 ", + Method = "󰆧 ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "󰕘", + Interface = "󰕘", + Function = "󰊕 ", + Variable = "󰆧 ", + Constant = "󰏿 ", + String = "󰀬 ", + Number = "󰎠 ", + Boolean = "◩ ", + Array = "󰅪 ", + Object = "󰅩 ", + Key = "󰌋 ", + Null = "󰟢 ", + EnumMember = " ", + Struct = "󰌗 ", + Event = " ", + Operator = "󰆕 ", + TypeParameter = "󰊄 ", + }, + trouble = { + File = " ", + Module = " ", + Namespace = " ", + Package = " ", + Class = " ", + Method = " ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = " ", + Interface = " ", + Function = " ", + Variable = " ", + Constant = " ", + String = " ", + Number = " ", + Boolean = " ", + Array = " ", + Object = " ", + Key = " ", + Null = " ", + EnumMember = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + }, + vscode = { + File = " ", + Module = " ", + Namespace = " ", + Package = " ", + Class = " ", + Method = " ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = " ", + Interface = " ", + Function = " ", + Variable = " ", + Constant = " ", + String = " ", + Number = " ", + Boolean = " ", + Array = " ", + Object = " ", + Key = " ", + Null = " ", + EnumMember = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + }, + }, } --- Smart-Splits plugin options @@ -638,7 +889,6 @@ M.smart_splits = { end end, } - --- Neominiap plugin options M.minimap = { -- Width of minimap @@ -737,6 +987,7 @@ M.trouble = { opts = { modes = { symbols = { -- Configure symbols mode + focus = true, win = { type = "split", -- split window relative = "win", -- relative to current window @@ -745,6 +996,22 @@ M.trouble = { }, }, }, + icons = { + indent = { + top = " ", + -- middle = "├╴", + middle = "", + -- last = "└╴", + -- last = "-╴", + last = "╰╴", + fold_open = " ", + fold_closed = " ", + ws = " ", + }, + folder_closed = " ", + folder_open = " ", + kinds = M.navic.icons.vscode, + }, }, } @@ -1003,6 +1270,9 @@ M.auto_dark_mode = { --- Image.nvim enabled filetypes M.image = "markdown" +--- Noice configuration options +M.noice = { presets = { inc_rename = true } } + --- Todo-comments plugin options M.todo = { keywords = { @@ -1079,6 +1349,13 @@ M.colorful_winsep = { }, } +--- Colorful Window Separators configuration options +M.winsep = { + only_line_seq = false, + symbols = M.colorful_winsep.symbols, + no_exec_files = M.colorful_winsep.no_exec_files, +} + --- Toggleterm plugin options M.toggleterm = { --- Sets the terminal panel size diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua index 9273755..17df178 100644 --- a/lua/plugins/ai.lua +++ b/lua/plugins/ai.lua @@ -31,19 +31,17 @@ return { opts = { provider = "openai" }, enabled = data.cond.minuet, }, - -- { - -- "jackMort/ChatGPT.nvim", - -- event = "VeryLazy", - -- opts = {}, - -- dependencies = { - -- "MunifTanjim/nui.nvim", - -- "nvim-lua/plenary.nvim", - -- "folke/trouble.nvim", - -- "nvim-telescope/telescope.nvim", - -- }, - -- }, - { + { -- ChatGPT + "jackMort/ChatGPT.nvim", + event = "VeryLazy", + keys = data.keys.chatgpt.func, + opts = data.types.chatgpt, + dependencies = data.deps.chatgpt, + }, + { -- GP "robitx/gp.nvim", - opts = {}, + lazy = false, + opts = data.types.gp, + keys = data.keys.gp.func, }, } diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 6ebf931..2b5b642 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -57,6 +57,17 @@ return { -- cmp } luasnip.config.setup({}) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 + and vim.api + .nvim_buf_get_lines(0, line - 1, line, true)[1] + :sub(col, col) + :match("%s") + == nil + end + cmp.setup({ snippet = { expand = function(args) @@ -78,14 +89,33 @@ return { -- cmp [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.confirm({ select = true }), [""] = cmp.mapping.complete({}), - [""] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- cmp.confirm({ select = true }) + elseif luasnip.expand_or_locally_jumpable() then luasnip.expand_or_jump() + elseif vim.snippet.active({ direction = 1 }) then + vim.schedule(function() + vim.snippet.jump(1) + end) + elseif has_words_before() then + cmp.complete() + else + fallback() end end, { "i", "s" }), - [""] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then luasnip.jump(-1) + elseif vim.snippet.active({ direction = -1 }) then + vim.schedule(function() + vim.snippet.jump(-1) + end) + else + fallback() end end, { "i", "s" }), }), @@ -98,8 +128,10 @@ return { -- cmp { name = "dotenv" }, { name = "calc" }, { name = "conventionalcommits" }, + { name = "nerd", priority = 9997 }, { name = "gitmoji", priority = 9998 }, { name = "emoji", priority = 9999 }, + { name = "math", priority = 9999 }, }, formatting = { fields = { "abbr", "kind", "menu" }, diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 80699cc..554344c 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -24,6 +24,16 @@ return { { -- Treesitter-context import = "lazyvim.plugins.extras.ui.treesitter-context", }, + { -- Mini.Indentscope + import = "lazyvim.plugins.extras.ui.mini-indentscope", + }, + { -- Mini Indentscope + "echasnovski/mini.indentscope", + opts = data.types.miniindentscope, + }, + { -- Navic + import = "lazyvim.plugins.extras.editor.navic", + }, { -- Trouble "folke/trouble.nvim", cmd = data.cmd.trouble, @@ -31,9 +41,7 @@ return { }, { -- Flash "folke/flash.nvim", - opts = { - modes = { char = { jump_labels = true } }, - }, + opts = data.types.flash, keys = data.keys.flash, }, { @@ -52,7 +60,7 @@ return { { -- NeoMiniMap "Isrothy/neominimap.nvim", lazy = false, - keys = data.keys.minimap, + keys = data.keys.minimap.func, init = data.types.minimap.init(), cond = data.types.minimap.cond(), }, @@ -81,16 +89,12 @@ return { "gen740/SmoothCursor.nvim", event = "BufEnter", -- lazy = true, - opts = { - cursor = "", - }, + opts = data.types.smoothcursor, }, { -- Smart Scrolloff "tonymajestro/smart-scrolloff.nvim", event = "VeryLazy", - opts = { - scrolloff_percentage = 0.25, - }, + opts = data.types.smartscrolloff, }, { -- Recorder "chrisgrieser/nvim-recorder", @@ -114,19 +118,13 @@ return { { -- Colorful window separators "nvim-zh/colorful-winsep.nvim", lazy = true, - opts = { - only_line_seq = false, - symbols = data.types.colorful_winsep.symbols, - no_exec_files = data.types.colorful_winsep.no_exec_files, - }, + opts = data.types.winsep, event = { "WinLeave" }, }, { -- Auto Cursorline "delphinus/auto-cursorline.nvim", enabled = data.func.check_global_var("auto_cursorline", true, true), - opts = { - wait_ms = 2000, - }, + opts = data.types.autocursorline, }, { -- Bars N Lines "OXY2DEV/bars-N-lines.nvim", @@ -134,31 +132,10 @@ return { lazy = false, config = data.types.barsNlines.config, }, - { -- UndoTree Telescope extension - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "debugloop/telescope-undo.nvim", - }, - opts = function() - require("telescope").load_extension("undo") - vim.keymap.set("n", "uU", "Telescope undo") - return { - extensions = { - undo = {}, - }, - } - end, - }, { -- UndoTree "mbbill/undotree", - config = function() - data.func.add_keymap( - "uu", - "UndotreeToggle", - "Toggle UndoTree" - ) - end, + opts = {}, + keys = data.keys.undotree, }, { -- NumberToggle "sitiom/nvim-numbertoggle", @@ -166,8 +143,6 @@ return { { "folke/noice.nvim", optional = true, - opts = { - presets = { inc_rename = true }, - }, + opts = data.types.noice, }, } diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 0b10f99..57cac9a 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -13,7 +13,7 @@ return { "Rawnly/gist.nvim", lazy = true, cmd = data.cmd.gist, - keys = data.keys.gist, + keys = data.keys.gist.func, config = true, }, { -- LazyGit @@ -46,28 +46,7 @@ return { }, { -- Git Graph "isakbm/gitgraph.nvim", - opts = { - symbols = data.types.gitgraph.symbols(), - format = { - timestamp = data.types.gitgraph.timestamp, - fields = data.types.gitgraph.fields, - }, - hooks = { - -- Check diff of a commit - on_select_commit = function(commit) - vim.notify("DiffviewOpen " .. commit.hash .. "^!") - vim.cmd(":DiffviewOpen " .. commit.hash .. "^!") - end, - -- Check diff from commit a -> commit b - on_select_range_commit = function(from, to) - vim.notify("DiffviewOpen " .. from.hash .. "~1.." .. to.hash) - vim.cmd(":DiffviewOpen " .. from.hash .. "~1.." .. to.hash) - end, - }, - }, + opts = data.types.gitgraph.opts, keys = data.keys.gitgraph, }, - { -- Telescope Git Worktree - "ThePrimeagen/git-worktree.nvim", - }, } diff --git a/lua/plugins/nvim_updater.lua b/lua/plugins/nvim_updater.lua index 93f3402..8834d7d 100644 --- a/lua/plugins/nvim_updater.lua +++ b/lua/plugins/nvim_updater.lua @@ -1,34 +1,14 @@ +local data = require("data") + return { -- Neovim Updater "rootiest/nvim-updater.nvim", lazy = false, opts = {}, - keys = { - { - "quU", - ":UpdateNeovim", - desc = "Update Neovim", - }, - { - "quD", - function() - require("nvim_updater").update_neovim({ build_type = "Debug" }) - end, - desc = "Debug Build Neovim", - }, - { - "quR", - function() - require("nvim_updater").update_neovim({ build_type = "Release" }) - end, - desc = "Release Build Neovim", - }, - { - "quC", - function() - require("nvim_updater").remove_source_dir() - end, - desc = "Clean Neovim Source", - }, - }, + keys = function() + -- Add Neovim Updater menu + data.func.add_keymap(data.keys.group.nvimup) + -- Add Neovim Updater keys + return data.keys.nvimup + end, dev = vim.g.rootiest_dev or false, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..4bd54c5 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,97 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ Telescope Plugins │ +-- ╰─────────────────────────────────────────────────────────╯ +---@module "plugins.telescope" +--- This module defines the telescope plugins specs for the Neovim configuration. + +local data = require("data") + +local P = { -- Define Telescope Plugins Specs + { -- Telescope Cmdline + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "jonarrien/telescope-cmdline.nvim", + }, + keys = data.keys.telescope.cmdline, + opts = data.types.telescope.cmdline, + config = function(_, opts) + require("telescope").setup(opts) + require("telescope").load_extension("cmdline") + end, + }, + { -- Telescope All Recent + "prochri/telescope-all-recent.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + "kkharji/sqlite.lua", + -- optional, if using telescope for vim.ui.select + "stevearc/dressing.nvim", + }, + opts = { + default = { + disable = true, -- disable any unkown pickers (recommended) + use_cwd = true, -- differentiate scoring for each picker based on cwd + sorting = "frecency", -- sorting: options: 'recent' and 'frecency' + }, + }, + }, + { -- Telescope Spell checker + "matkrin/telescope-spell-errors.nvim", + lazy = true, + cmd = data.cmd.spell_errors, + config = function() + require("telescope").load_extension("spell_errors") + end, + dependencies = data.deps.needs_telescope, + }, + { -- Telescope symbols + "nvim-telescope/telescope-symbols.nvim", + config = function() end, + keys = data.keys.telescope.symbols, + lazy = false, + }, + { -- Telescope Toggleterm + "ryanmsnyder/toggleterm-manager.nvim", + dependencies = { + "akinsho/nvim-toggleterm.lua", + "nvim-telescope/telescope.nvim", + "nvim-lua/plenary.nvim", -- only needed because it's a dependency of telescope + }, + config = true, + keys = data.keys.telescope.toggleterm, + }, + { -- Telescope Lazy + "nvim-telescope/telescope.nvim", + dependencies = "tsakirist/telescope-lazy.nvim", + keys = data.keys.telescope.lazy, + }, + { -- Telescope Luasnip + "benfowler/telescope-luasnip.nvim", + module = "telescope._extensions.luasnip", -- if you wish to lazy-load + config = function() + require("telescope").load_extension("luasnip") + end, + }, + { -- Telescope Git Worktree + "ThePrimeagen/git-worktree.nvim", + }, + { -- UndoTree Telescope extension + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "debugloop/telescope-undo.nvim", + }, + opts = function() + require("telescope").load_extension("undo") + vim.keymap.set("n", "uU", "Telescope undo") + return { + extensions = { + undo = {}, + }, + } + end, + }, +} + +return P diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua index fce6438..a5374d4 100644 --- a/lua/plugins/util.lua +++ b/lua/plugins/util.lua @@ -32,11 +32,7 @@ return { enabled = data.func.check_global_var("auto_save", true, true), cmd = data.cmd.autosave, event = { "InsertLeave", "TextChanged" }, - opts = { - execution_message = { - enabled = false, - }, - }, + opts = data.types.autosave, }, { -- Ripgrep substitute "chrisgrieser/nvim-rip-substitute", @@ -55,21 +51,13 @@ return { enabled = data.func.check_global_var("codesnap", true, true), lazy = true, build = "make", - opts = { - save_path = "~/Pictures/Screenshots/", - has_breadcrumbs = true, - show_workspace = true, - bg_theme = "default", - watermark = "Rootiest Snippets", - code_font_family = "Iosevka NF", - code_font_size = 12, - }, + opts = data.types.codesnap, cmd = data.cmd.codesnap, keys = data.keys.codesnap, }, { -- Kulala "mistweaverco/kulala.nvim", - ft = { "http", "https", "ftp", "ftps" }, + ft = data.types.kulala.ft, opts = {}, }, { -- Hardtime @@ -110,6 +98,7 @@ return { }, { -- Encourage "r-cha/encourage.nvim", + enabled = data.func.check_global_var("encourage", true, true), config = true, }, { -- Helpview @@ -120,19 +109,7 @@ return { { -- Suda "lambdalisue/vim-suda", cmd = data.cmd.suda, - config = function() - vim.g.suda_smart_edit = 1 - vim.cmd("let g:suda#prompt = '  Enter Sudo Password  '") - end, - }, - { -- Spell checker - "matkrin/telescope-spell-errors.nvim", - lazy = true, - cmd = data.cmd.spell_errors, - config = function() - require("telescope").load_extension("spell_errors") - end, - dependencies = data.deps.needs_telescope, + config = data.types.suda, }, { -- Pigeon "Pheon-Dev/pigeon", @@ -144,60 +121,4 @@ return { enable_line_number = true, }, }, - { -- Telescope Cmdline - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "jonarrien/telescope-cmdline.nvim", - }, - keys = data.keys.telescope.cmdline, - opts = data.types.telescope.cmdline, - config = function(_, opts) - require("telescope").setup(opts) - require("telescope").load_extension("cmdline") - end, - }, - { - "prochri/telescope-all-recent.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - "kkharji/sqlite.lua", - -- optional, if using telescope for vim.ui.select - "stevearc/dressing.nvim", - }, - opts = { - default = { - disable = true, -- disable any unkown pickers (recommended) - use_cwd = true, -- differentiate scoring for each picker based on cwd - sorting = "frecency", -- sorting: options: 'recent' and 'frecency' - }, - }, - }, - { -- Telescope symbols - "nvim-telescope/telescope-symbols.nvim", - config = function() end, - keys = data.keys.telescope.symbols, - }, - { -- Telescope Toggleterm - "ryanmsnyder/toggleterm-manager.nvim", - dependencies = { - "akinsho/nvim-toggleterm.lua", - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim", -- only needed because it's a dependency of telescope - }, - config = true, - keys = data.keys.telescope.toggleterm, - }, - { - "nvim-telescope/telescope.nvim", - dependencies = "tsakirist/telescope-lazy.nvim", - keys = data.keys.telescope.lazy, - }, - { - "benfowler/telescope-luasnip.nvim", - module = "telescope._extensions.luasnip", -- if you wish to lazy-load - config = function() - require("telescope").load_extension("luasnip") - end, - }, } diff --git a/lua/utils/cmd_window.lua b/lua/utils/cmd_window.lua deleted file mode 100644 index 5b80fb6..0000000 --- a/lua/utils/cmd_window.lua +++ /dev/null @@ -1,140 +0,0 @@ ----@module "utils.cmd_window" ---- This module provides a function to open a floating window with a completion menu. --- ╭─────────────────────────────────────────────────────────╮ --- │ Rootiest Command Window │ --- ╰─────────────────────────────────────────────────────────╯ - -local M = {} - -function M.open_floating_window_with_completion() - local buf = vim.api.nvim_create_buf(false, true) -- Create a new buffer - local win_height = 1 -- Height of floating window - local win_width = math.floor(vim.o.columns * 0.25) -- Width of floating window - local row = math.floor((vim.o.lines - win_height) / 2) -- Position row - local col = math.floor((vim.o.columns - win_width) / 2) -- Position column - local win_border = "rounded" - - -- Create a floating window - local win = vim.api.nvim_open_win(buf, true, { - relative = "editor", - width = win_width, - height = win_height, - col = col, - row = row, - border = win_border, - }) - - -- Set the buffer's filetype - vim.bo[buf].filetype = "cmdline" -- Set a unique filetype - - -- Variables to manage history - _G.history_index = 0 - _G.history_size = vim.fn.histnr("cmd") - - -- Function to close the window - M.close_window = function() - vim.api.nvim_win_close(win, true) -- Close the window - -- Switch back to normal mode - vim.api.nvim_command("stopinsert") - end - - -- Function to execute the command - M.execute_command = function() - local cmd = vim.api.nvim_buf_get_lines(buf, 0, -1, false)[1] or "" - -- Ensure abbreviation expansion - vim.api.nvim_command("execute 'silent! " .. cmd .. "'") - M.close_window() - end - - -- Function to handle navigation and clear buffer - M.handle_history_navigation = function(direction) - -- Update history index - _G.history_index = (_G.history_index + direction) % _G.history_size - if _G.history_index < 0 then - _G.history_index = _G.history_size - 1 - end - - -- Clear the buffer - vim.api.nvim_buf_set_lines(buf, 0, -1, false, {}) - - -- Fetch history item and insert into buffer - local history_cmd = vim.fn["histget"]("cmd", _G.history_index + 1) - vim.api.nvim_buf_set_lines(buf, 0, -1, false, { history_cmd or "" }) - vim.api.nvim_win_set_cursor(win, { 1, #history_cmd or 0 }) - end - - -- Setup keymaps for buffer - -- Map to execute the command - vim.api.nvim_buf_set_keymap( - buf, - "i", - "", - [[lua require('utils.cmd_window').execute_command()]], - { noremap = true, silent = true } - ) - -- Map to close the window - vim.api.nvim_buf_set_keymap( - buf, - "i", - "", - [[lua require('utils.cmd_window').close_window()]], - { noremap = true, silent = true } - ) - -- Map to navigate command history - vim.api.nvim_buf_set_keymap( - buf, - "i", - "", - [[lua require('utils.cmd_window').handle_history_navigation(-1)]], - { noremap = true, silent = true } - ) - -- Map to navigate command history - vim.api.nvim_buf_set_keymap( - buf, - "i", - "", - [[lua require('utils.cmd_window').handle_history_navigation(1)]], - { noremap = true, silent = true } - ) - -- Map to navigate command history - vim.api.nvim_buf_set_keymap( - buf, - "i", - "", - [[lua require('utils.cmd_window').handle_history_navigation(1)]], - { noremap = true, silent = true } - ) - -- Map to navigate command history - vim.api.nvim_buf_set_keymap( - buf, - "i", - "", - [[lua require('utils.cmd_window').handle_history_navigation(-1)]], - { noremap = true, silent = true } - ) - - -- Start in insert mode - vim.api.nvim_command("startinsert") -end - -M.setup = function(opts) - opts = opts or {} - - -- Add a user command to open the floating window - vim.api.nvim_create_user_command( - "FloatingWindowWithCompletion", - M.open_floating_window_with_completion, - {} - ) - - -- Optionally override default command-line behavior - if opts.override_cmdline then - require("data").func.add_keymap( - ":", - "lua require('utils.cmd_window').open_floating_window_with_completion()", - "FloatingWindowWithCompletion" - ) - end -end - -return M diff --git a/lua/utils/highlight.lua b/lua/utils/highlight.lua index 7a1b362..f10f57d 100644 --- a/lua/utils/highlight.lua +++ b/lua/utils/highlight.lua @@ -74,20 +74,19 @@ function M.setup_indent_highlight() require("ibl").setup({ indent = { char = vim.g.indent_char or data.types.ibl.indent_char.none, + tab_char = vim.g.tab_char or data.types.ibl.tab_char.simple, highlight = { "IndentBlanklineIndent", }, }, scope = { - show_start = true, - highlight = { - "IndentsScopeHighlight", - "IndentsScopeHighlight", - }, - char = vim.g.scope_char or data.types.ibl.scope_char.hard, - }, - whitespace = { - remove_blankline_trail = true, + enabled = false, + -- show_start = true, + -- highlight = { + -- "IndentsScopeHighlight", + -- "IndentsScopeHighlight", + -- }, + -- char = vim.g.scope_char or data.types.ibl.scope_char.hard, }, exclude = { filetypes = data.types.highlights.exclude,