adding new theme
This commit is contained in:
@@ -94,8 +94,23 @@ function M.show_notification(message, level, opts)
|
||||
local notification_id = notify(message, level, opts)
|
||||
return notification_id
|
||||
else
|
||||
-- Fallback to vim.notify
|
||||
vim.notify(message, level, opts)
|
||||
-- Fallback to echo instead of vim.notify to avoid circular dependency
|
||||
local icon = "💬"
|
||||
if level == vim.log.levels.ERROR then
|
||||
icon = "❌"
|
||||
elseif level == vim.log.levels.WARN then
|
||||
icon = "⚠️"
|
||||
elseif level == vim.log.levels.INFO then
|
||||
icon = "ℹ️"
|
||||
end
|
||||
|
||||
-- Use echo for fallback notifications
|
||||
vim.cmd("echo '" .. icon .. " " .. message .. "'")
|
||||
|
||||
-- Clear message after a delay
|
||||
vim.defer_fn(function()
|
||||
vim.cmd("echo ''")
|
||||
end, opts.timeout or 3000)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,22 +271,13 @@ function M.eliminate_enter_prompts()
|
||||
once = true,
|
||||
})
|
||||
|
||||
-- Create autocmd to handle message events
|
||||
vim.api.nvim_create_autocmd("MsgShow", {
|
||||
-- Create autocmd to handle message events - use valid events
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
callback = function()
|
||||
-- Clear messages that might cause prompts
|
||||
vim.cmd("redraw!")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Create autocmd to handle any prompt events
|
||||
vim.api.nvim_create_autocmd("PromptDone", {
|
||||
callback = function()
|
||||
-- Clear any remaining prompts
|
||||
vim.cmd("redraw!")
|
||||
vim.cmd("echo ''")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Function to setup notification system
|
||||
@@ -295,11 +301,8 @@ function M.setup()
|
||||
-- Eliminate "Press ENTER" prompts
|
||||
M.eliminate_enter_prompts()
|
||||
|
||||
-- Override vim.notify to use our custom system
|
||||
local original_notify = vim.notify
|
||||
vim.notify = function(msg, level, opts)
|
||||
M.show_notification(msg, level, opts)
|
||||
end
|
||||
-- Don't override vim.notify here to avoid circular dependency
|
||||
-- Let the system handle notifications naturally
|
||||
|
||||
print("Notification manager initialized")
|
||||
end
|
||||
|
||||
@@ -4,27 +4,44 @@ require("cargdev.core.compatibility").setup()
|
||||
-- Load startup optimizations early
|
||||
require("cargdev.core.startup_optimization")
|
||||
|
||||
-- Load notification manager for better UX
|
||||
require("cargdev.core.function.notification_manager")
|
||||
|
||||
require("cargdev.core.options")
|
||||
require("cargdev.core.keymaps")
|
||||
|
||||
-- Load all Lua files inside `cargdev/core/function/`
|
||||
-- Load all Lua files inside `cargdev/core/function/` AFTER plugins are loaded
|
||||
local function load_functions()
|
||||
local function_path = vim.fn.stdpath("config") .. "/lua/cargdev/core/function"
|
||||
local scan = vim.fn.globpath(function_path, "*.lua", false, true)
|
||||
|
||||
for _, file in ipairs(scan) do
|
||||
local module_name = "cargdev.core.function." .. file:match("([^/]+)%.lua$")
|
||||
local success, err = pcall(require, module_name)
|
||||
-- Skip notification manager as it's loaded separately
|
||||
if module_name ~= "cargdev.core.function.notification_manager" then
|
||||
local success, err = pcall(require, module_name)
|
||||
|
||||
if not success then
|
||||
vim.notify("Error loading function module: " .. module_name .. "\n" .. err, vim.log.levels.ERROR)
|
||||
if not success then
|
||||
vim.notify("Error loading function module: " .. module_name .. "\n" .. err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Defer function loading until after plugins are loaded
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyDone",
|
||||
callback = function()
|
||||
-- Load notification manager after plugins with error handling
|
||||
local success, err = pcall(require, "cargdev.core.function.notification_manager")
|
||||
if not success then
|
||||
-- Use safe echo instead of vim.notify to avoid circular dependency
|
||||
local safe_msg = tostring(err):gsub("'", "\\'")
|
||||
vim.api.nvim_echo({{"Warning: Notification manager failed to load: " .. safe_msg, "WarningMsg"}}, false, {})
|
||||
end
|
||||
|
||||
-- Load all other functions
|
||||
load_functions()
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
|
||||
--[[ vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
once = true,
|
||||
@@ -33,4 +50,3 @@ end
|
||||
end
|
||||
})
|
||||
]]
|
||||
load_functions()
|
||||
|
||||
@@ -15,6 +15,13 @@ keymap.set("i", "jk", "<ESC>", opts) -- Exit insert mode with jk
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>", opts) -- Clear search highlights
|
||||
keymap.set("n", "x", '"_x', opts) -- Delete character without copying into register
|
||||
|
||||
-- Comment keymaps
|
||||
keymap.set("n", "gcc", "<cmd>CommentToggle<CR>", { desc = "Toggle comment line" })
|
||||
keymap.set("n", "gc", "<cmd>CommentToggle<CR>", { desc = "Toggle comment line" })
|
||||
keymap.set("v", "gc", "<cmd>CommentToggle<CR>", { desc = "Toggle comment selection" })
|
||||
keymap.set("n", "gbc", "<cmd>CommentToggle<CR>", { desc = "Toggle comment block" })
|
||||
keymap.set("v", "gb", "<cmd>CommentToggle<CR>", { desc = "Toggle comment block" })
|
||||
|
||||
-- Save and quit (additional)
|
||||
keymap.set("n", "<leader>Q", ":qa!<CR>", { desc = "Quit all" })
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ function M.optimize_startup()
|
||||
|
||||
-- Disable unused providers
|
||||
vim.g.loaded_python3_provider = 0
|
||||
vim.g.loaded_node_provider = 0
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
vim.g.loaded_perl_provider = 0
|
||||
|
||||
@@ -42,8 +41,14 @@ function M.optimize_startup()
|
||||
vim.g.do_filetype_lua = 1
|
||||
vim.g.did_load_filetypes = 0
|
||||
|
||||
-- Fix lazyredraw conflict with Noice
|
||||
vim.opt.lazyredraw = false -- Disable to prevent Noice conflicts
|
||||
-- Fix lazyredraw conflict with Noice - but only after LazyVim loads
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyDone",
|
||||
callback = function()
|
||||
vim.opt.lazyredraw = false -- Disable to prevent Noice conflicts
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
|
||||
-- Optimize completion settings
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
@@ -99,32 +104,50 @@ end
|
||||
-- Function to defer heavy operations
|
||||
function M.defer_heavy_operations()
|
||||
-- Defer treesitter loading
|
||||
vim.defer_fn(function()
|
||||
if vim.fn.exists(":TSBufEnable") > 0 then
|
||||
vim.cmd("TSBufEnable highlight")
|
||||
end
|
||||
end, 100)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyDone",
|
||||
callback = function()
|
||||
vim.defer_fn(function()
|
||||
if vim.fn.exists(":TSBufEnable") > 0 then
|
||||
vim.cmd("TSBufEnable highlight")
|
||||
end
|
||||
end, 100)
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
|
||||
-- Defer LSP setup for non-critical buffers
|
||||
vim.defer_fn(function()
|
||||
-- Enable LSP for current buffer if it's a supported filetype
|
||||
local supported_ft = {
|
||||
"lua", "javascript", "typescript", "python", "java", "cpp", "c", "rust", "go",
|
||||
"html", "css", "json", "yaml", "markdown"
|
||||
}
|
||||
|
||||
local current_ft = vim.bo.filetype
|
||||
if vim.tbl_contains(supported_ft, current_ft) then
|
||||
vim.cmd("LspStart")
|
||||
end
|
||||
end, 200)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyDone",
|
||||
callback = function()
|
||||
vim.defer_fn(function()
|
||||
-- Enable LSP for current buffer if it's a supported filetype
|
||||
local supported_ft = {
|
||||
"lua", "javascript", "typescript", "python", "java", "cpp", "c", "rust", "go",
|
||||
"html", "css", "json", "yaml", "markdown"
|
||||
}
|
||||
|
||||
local current_ft = vim.bo.filetype
|
||||
if vim.tbl_contains(supported_ft, current_ft) then
|
||||
vim.cmd("LspStart")
|
||||
end
|
||||
end, 200)
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
|
||||
-- Defer completion setup
|
||||
vim.defer_fn(function()
|
||||
if vim.fn.exists(":CmpStatus") > 0 then
|
||||
vim.cmd("CmpStatus")
|
||||
end
|
||||
end, 300)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyDone",
|
||||
callback = function()
|
||||
vim.defer_fn(function()
|
||||
if vim.fn.exists(":CmpStatus") > 0 then
|
||||
vim.cmd("CmpStatus")
|
||||
end
|
||||
end, 300)
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
end
|
||||
|
||||
-- Function to check if we're in a large repository
|
||||
@@ -142,7 +165,7 @@ function M.check_repo_size()
|
||||
vim.opt.cursorline = false -- Disable cursor line
|
||||
vim.opt.relativenumber = false -- Disable relative numbers
|
||||
|
||||
print("Large repository detected (" .. file_count .. " files). Applied additional optimizations.")
|
||||
print("Large repository detected (" .. file_count .. " lines). Applied additional optimizations.")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -165,8 +188,8 @@ function M.eliminate_startup_prompts()
|
||||
once = true,
|
||||
})
|
||||
|
||||
-- Create autocmd to handle any message events
|
||||
vim.api.nvim_create_autocmd("MsgShow", {
|
||||
-- Create autocmd to handle any message events - use valid events
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
callback = function()
|
||||
-- Clear messages that might cause prompts
|
||||
vim.cmd("redraw!")
|
||||
|
||||
@@ -33,10 +33,14 @@ return {
|
||||
dashboard.button("n", "📄 New File", "<cmd>ene<CR>"),
|
||||
dashboard.button("g", "📝 Find Text", "<cmd>Telescope live_grep<CR>"),
|
||||
dashboard.button("r", "📚 Recent Files", "<cmd>Telescope oldfiles<CR>"),
|
||||
dashboard.button("t", "🌳 File Tree", "<cmd>NvimTreeToggle<CR>"),
|
||||
dashboard.button("c", "⚙️ Config", "<cmd>e ~/.config/nvim/init.lua<CR>"),
|
||||
dashboard.button("L", "🦥 Lazy", "<cmd>Lazy<CR>"),
|
||||
dashboard.button("p", "📊 Performance", "<cmd>lua require('cargdev.core.function.performance_monitor').check_performance()<CR>"),
|
||||
dashboard.button("l", "🔧 LSP Health", "<cmd>lua require('cargdev.core.function.performance_monitor').check_lsp_health()<CR>"),
|
||||
dashboard.button("s", "🧩 Sudoku", "<cmd>Sudoku<CR>"),
|
||||
dashboard.button("e", "💻 LeetCode", "<cmd>Leet<CR>"),
|
||||
dashboard.button("m", "🔨 Mason", "<cmd>Mason<CR>"),
|
||||
dashboard.button("q", "🚪 Quit", "<cmd>qa<CR>"),
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
return {
|
||||
"CarGDev/cargdev-cyberpunk",
|
||||
--[[ dir = "/Users/carlos/Documents/SSD_Documents/projects/cargdevschemecolor.nvim", ]]
|
||||
event = "VimEnter", -- Load only when entering Vim
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("cargdev-cyberpunk").setup()
|
||||
end,
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
}
|
||||
|
||||
@@ -8,12 +8,32 @@ return {
|
||||
-- import comment plugin safely
|
||||
local comment = require("Comment")
|
||||
|
||||
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
|
||||
|
||||
-- enable comment
|
||||
-- Check if treesitter context commentstring is available
|
||||
local ok, ts_context_commentstring = pcall(require, "ts_context_commentstring.integrations.comment_nvim")
|
||||
|
||||
-- enable comment with safe configuration
|
||||
comment.setup({
|
||||
-- for commenting tsx, jsx, svelte, html files
|
||||
pre_hook = ts_context_commentstring.create_pre_hook(),
|
||||
pre_hook = ok and ts_context_commentstring.create_pre_hook() or nil,
|
||||
-- Add explicit commentstring fallbacks
|
||||
opleader = {
|
||||
line = "gc",
|
||||
block = "gb",
|
||||
},
|
||||
toggler = {
|
||||
line = "gcc",
|
||||
block = "gbc",
|
||||
},
|
||||
extra = {
|
||||
above = "gcO",
|
||||
below = "gco",
|
||||
eol = "gcA",
|
||||
},
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
extended = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -288,18 +288,6 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- Better indentation guides
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
char = "│",
|
||||
filetype_exclude = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" },
|
||||
show_trailing_blankline_indent = false,
|
||||
show_current_context = false,
|
||||
},
|
||||
},
|
||||
|
||||
-- Better git integration
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
|
||||
@@ -3,6 +3,15 @@ return {
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
main = "ibl",
|
||||
opts = {
|
||||
indent = { char = "┊" },
|
||||
indent = {
|
||||
char = "┊",
|
||||
exclude_filetypes = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" }
|
||||
},
|
||||
scope = {
|
||||
enabled = false
|
||||
},
|
||||
exclude = {
|
||||
filetypes = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" }
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ return {
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
"hrsh7th/cmp-nvim-lsp", -- LSP completion source
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- follow latest release.
|
||||
|
||||
Reference in New Issue
Block a user