Compare commits
2 Commits
9638b5346d
...
1c3558380e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c3558380e | ||
|
|
bf573ef961 |
208
NVIM_PERFORMANCE_ANALYSIS.md
Normal file
208
NVIM_PERFORMANCE_ANALYSIS.md
Normal file
@@ -0,0 +1,208 @@
|
||||
# Neovim Performance Analysis & Optimization Results
|
||||
|
||||
## Overview
|
||||
This document analyzes the performance profile from `nvim-profile.log` and shows the results of applied optimizations.
|
||||
|
||||
## 📊 Performance Comparison Results
|
||||
|
||||
### ✅ **Significant Improvements**
|
||||
|
||||
#### 1. Clipboard Provider Performance
|
||||
- **Before**: 2.16s total time, 123 calls
|
||||
- **After**: 0.54s total time, 78 calls
|
||||
- **Improvement**: **75% reduction** in total time, **37% fewer** calls
|
||||
- **Status**: ✅ **MAJOR SUCCESS**
|
||||
|
||||
#### 2. Syntax Loading Performance
|
||||
- **Before**: 0.70s total time, 699 calls
|
||||
- **After**: 0.47s total time, 189 calls
|
||||
- **Improvement**: **33% reduction** in total time, **73% fewer** calls
|
||||
- **Status**: ✅ **SUCCESS**
|
||||
|
||||
#### 3. Filetype Plugin Loading
|
||||
- **Before**: 0.70s total time, 278 calls
|
||||
- **After**: 0.62s total time, 175 calls
|
||||
- **Improvement**: **11% reduction** in total time, **37% fewer** calls
|
||||
- **Status**: ✅ **MODERATE SUCCESS**
|
||||
|
||||
### ⚠️ **Performance Regressions**
|
||||
|
||||
#### 4. WakaTime Plugin Performance
|
||||
- **Before**: 0.48s total time, 686 calls
|
||||
- **After**: 1.82s total time, 2,052 calls
|
||||
- **Change**: **279% increase** in total time, **199% more** calls
|
||||
- **Status**: ❌ **REGRESSION** - Need to investigate
|
||||
|
||||
#### 5. Matchparen Highlighting
|
||||
- **Before**: 0.23s total time, 2,912 calls
|
||||
- **After**: 0.78s total time, 6,055 calls
|
||||
- **Change**: **239% increase** in total time, **108% more** calls
|
||||
- **Status**: ❌ **REGRESSION** - Need to investigate
|
||||
|
||||
## 🔧 Applied Optimizations
|
||||
|
||||
### ✅ Successful Optimizations
|
||||
|
||||
#### 1. Keymap Conflict Resolution
|
||||
- **Fixed**: Changed `<leader>s` to `<leader>sub` to avoid conflict with `<leader>fs`
|
||||
- **File**: `lua/cargdev/core/keymaps/plugins.lua`
|
||||
- **Impact**: `<leader>fs` now works correctly for file search
|
||||
- **Status**: ✅ **CONFIRMED WORKING**
|
||||
|
||||
#### 2. Clipboard Provider Optimization
|
||||
- **Fixed**: Added explicit macOS clipboard configuration
|
||||
- **File**: `lua/cargdev/core/options.lua`
|
||||
- **Changes**: Configured `pbcopy`/`pbpaste` with caching enabled
|
||||
- **Result**: **75% performance improvement**
|
||||
- **Status**: ✅ **MAJOR SUCCESS**
|
||||
|
||||
#### 3. Syntax Loading Optimization
|
||||
- **Fixed**: Optimized syntax highlighting settings
|
||||
- **File**: `lua/cargdev/core/options.lua`
|
||||
- **Changes**: Reduced `synmaxcol` to 200, disabled modelines
|
||||
- **Result**: **33% performance improvement**
|
||||
- **Status**: ✅ **SUCCESS**
|
||||
|
||||
#### 4. Filetype Plugin Optimization
|
||||
- **Fixed**: Optimized filetype plugin loading
|
||||
- **File**: `lua/cargdev/core/options.lua`
|
||||
- **Changes**: Disabled modelines for security and performance
|
||||
- **Result**: **11% performance improvement**
|
||||
- **Status**: ✅ **MODERATE SUCCESS**
|
||||
|
||||
### ❌ Failed Optimizations
|
||||
|
||||
#### 5. WakaTime Performance Optimization
|
||||
- **Attempted**: Optimized heartbeat frequency and buffering
|
||||
- **File**: `lua/cargdev/plugins/wakatime.lua`
|
||||
- **Changes**: Increased heartbeat frequency to 2 minutes, enabled buffering
|
||||
- **Result**: **279% performance regression**
|
||||
- **Status**: ❌ **NEEDS REVERT**
|
||||
|
||||
#### 6. Matchparen Performance Optimization
|
||||
- **Attempted**: Reduced timeout values for faster response
|
||||
- **File**: `lua/cargdev/core/options.lua`
|
||||
- **Changes**: Reduced `matchparen_timeout` to 100ms, `matchparen_insert_timeout` to 50ms
|
||||
- **Result**: **239% performance regression**
|
||||
- **Status**: ❌ **NEEDS REVERT**
|
||||
|
||||
## 🚨 Issues Requiring Immediate Attention
|
||||
|
||||
### 1. WakaTime Regression
|
||||
**Problem**: WakaTime is now consuming significantly more resources
|
||||
**Possible Causes**:
|
||||
- Buffering enabled may be causing overhead
|
||||
- Increased heartbeat frequency may be triggering more processing
|
||||
- Debug mode changes may have unintended effects
|
||||
|
||||
**Recommended Actions**:
|
||||
- Revert WakaTime configuration to original settings
|
||||
- Consider disabling WakaTime temporarily to measure impact
|
||||
- Investigate alternative WakaTime configurations
|
||||
|
||||
### 2. Matchparen Regression
|
||||
**Problem**: Matchparen highlighting is now much slower
|
||||
**Possible Causes**:
|
||||
- Reduced timeout values may be causing more frequent recalculations
|
||||
- Timeout settings may be conflicting with other optimizations
|
||||
- The optimization may have triggered a different code path
|
||||
|
||||
**Recommended Actions**:
|
||||
- Revert matchparen timeout settings to defaults
|
||||
- Test with original settings to confirm improvement
|
||||
- Consider alternative matchparen optimization strategies
|
||||
|
||||
## 📈 Overall Performance Impact
|
||||
|
||||
### Net Performance Change
|
||||
- **Clipboard**: +1.62s improvement
|
||||
- **Syntax**: +0.23s improvement
|
||||
- **Filetype**: +0.08s improvement
|
||||
- **WakaTime**: -1.34s regression
|
||||
- **Matchparen**: -0.55s regression
|
||||
|
||||
**Net Result**: **+0.04s improvement** (essentially neutral)
|
||||
|
||||
### Recommendations
|
||||
1. **Keep successful optimizations** (clipboard, syntax, filetype)
|
||||
2. **Revert failed optimizations** (WakaTime, matchparen)
|
||||
3. **Investigate alternative approaches** for WakaTime and matchparen
|
||||
4. **Consider disabling WakaTime** if not actively used
|
||||
|
||||
## 🔍 **Additional Performance Issues Discovered**
|
||||
|
||||
### 6. CursorHold Events Performance
|
||||
- **Total Time**: 0.92s (CursorHold_Cb) + 0.30s (CursorHoldI_Cb) = **1.22s total**
|
||||
- **Calls**: 1,213 + 625 = **1,838 calls**
|
||||
- **Issue**: FixCursorHold plugin is consuming significant resources
|
||||
- **Status**: ⚠️ **NEW ISSUE** - Major performance bottleneck
|
||||
|
||||
### 7. Tmux Navigation Performance
|
||||
- **Total Time**: 0.61s (TmuxAwareNavigate) + 0.56s (VimNavigate) = **1.17s total**
|
||||
- **Calls**: 63 + 63 = **126 calls**
|
||||
- **Issue**: Tmux-aware navigation is slow
|
||||
- **Status**: ⚠️ **NEW ISSUE** - Significant overhead
|
||||
|
||||
### 8. Treesitter Indentation Performance
|
||||
- **Total Time**: 0.08s
|
||||
- **Calls**: 15 calls
|
||||
- **Issue**: Treesitter indentation is being called frequently
|
||||
- **Status**: ⚠️ **NEW ISSUE** - Moderate impact
|
||||
|
||||
### 9. WakaTime Heartbeat System
|
||||
- **Total Time**: 0.98s (SetLastHeartbeat) + 0.11s (SendHeartbeats) = **1.09s total**
|
||||
- **Calls**: 206 + 60 = **266 calls**
|
||||
- **Issue**: Heartbeat system is very slow
|
||||
- **Status**: ❌ **MAJOR ISSUE** - Part of WakaTime regression
|
||||
|
||||
## 📊 **Updated Performance Summary**
|
||||
|
||||
### Total Performance Impact (All Issues)
|
||||
- **WakaTime System**: 2.91s total (HandleActivity + Heartbeats)
|
||||
- **CursorHold Events**: 1.22s total
|
||||
- **Tmux Navigation**: 1.17s total
|
||||
- **Matchparen**: 0.78s total
|
||||
- **Clipboard**: 0.54s total (improved from 2.16s)
|
||||
- **Syntax Loading**: 0.47s total (improved from 0.70s)
|
||||
- **Filetype Plugins**: 0.62s total (improved from 0.70s)
|
||||
|
||||
**Total Identified Issues**: **~7.7 seconds** of performance overhead
|
||||
|
||||
## 🚨 **Critical Issues Requiring Immediate Attention**
|
||||
|
||||
### 1. WakaTime Complete System Failure
|
||||
- **Problem**: Entire WakaTime system is consuming 2.91s total
|
||||
- **Components**: HandleActivity (1.82s) + Heartbeats (1.09s)
|
||||
- **Impact**: Single biggest performance bottleneck
|
||||
- **Action**: **DISABLE WAKATIME IMMEDIATELY**
|
||||
|
||||
### 2. CursorHold Events Overhead
|
||||
- **Problem**: FixCursorHold plugin consuming 1.22s
|
||||
- **Impact**: Major performance hit on cursor movement
|
||||
- **Action**: **OPTIMIZE OR DISABLE FixCursorHold**
|
||||
|
||||
### 3. Tmux Navigation Overhead
|
||||
- **Problem**: Tmux-aware navigation consuming 1.17s
|
||||
- **Impact**: Significant overhead for navigation
|
||||
- **Action**: **OPTIMIZE Tmux integration**
|
||||
|
||||
## 🎯 **Revised Priority Actions**
|
||||
|
||||
### Immediate (Critical)
|
||||
1. **Disable WakaTime completely** - Save 2.91s
|
||||
2. **Optimize FixCursorHold** - Save up to 1.22s
|
||||
3. **Revert matchparen settings** - Save 0.55s
|
||||
|
||||
### High Priority
|
||||
4. **Optimize Tmux navigation** - Save up to 1.17s
|
||||
5. **Investigate Treesitter indentation** - Save up to 0.08s
|
||||
|
||||
### Medium Priority
|
||||
6. **Keep successful optimizations** (clipboard, syntax, filetype)
|
||||
|
||||
**Potential Total Savings**: **~5.8 seconds** (75% improvement)
|
||||
|
||||
---
|
||||
*Analysis based on comparison of original and optimized nvim-profile.log*
|
||||
*Last updated: $(date)*
|
||||
*Keymap conflict: ✅ Fixed | Clipboard: ✅ 75% improvement | Syntax: ✅ 33% improvement | Filetype: ✅ 11% improvement | WakaTime: ❌ 279% regression | Matchparen: ❌ 239% regression*
|
||||
@@ -4,6 +4,15 @@
|
||||
-- Main core initialization for cargdev Neovim config
|
||||
-- =============================================================================
|
||||
|
||||
-- 0. Setup LuaRocks path for rest.nvim dependencies (Lua 5.1 - Neovim uses LuaJIT)
|
||||
local function setup_luarocks_path()
|
||||
local luarocks_path = vim.fn.system("luarocks path --lr-path --lua-version=5.1 --local"):gsub("\n", "")
|
||||
if luarocks_path and luarocks_path ~= "" then
|
||||
package.path = package.path .. ";" .. luarocks_path
|
||||
end
|
||||
end
|
||||
setup_luarocks_path()
|
||||
|
||||
-- 1. Compatibility Layer
|
||||
require("cargdev.core.compatibility").setup()
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
-- Copilot Chat keymaps
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("v", "<leader>zn", ":CopilotChatRename<CR>", { desc = "Rename variable (Copilot Chat)" })
|
||||
keymap.set("n", "<leader>zc", ":CopilotChat<CR>", { desc = "Open Copilot Chat" })
|
||||
keymap.set("v", "<leader>ze", ":CopilotChatExplain<CR>", { desc = "Explain code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zr", ":CopilotChatReview<CR>", { desc = "Review code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zf", ":CopilotChatFix<CR>", { desc = "Fix code issues (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zo", ":CopilotChatOptimize<CR>", { desc = "Optimize code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (Copilot Chat)" })
|
||||
keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
||||
keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Copilot: Disabled" })
|
||||
keymap.set("n", "<leader>cs", ":Copilot status<CR>", { desc = "Copilot: Status" })
|
||||
-- -- Copilot Chat keymaps
|
||||
-- local keymap = vim.keymap
|
||||
--
|
||||
-- keymap.set("v", "<leader>zn", ":CopilotChatRename<CR>", { desc = "Rename variable (Copilot Chat)" })
|
||||
-- keymap.set("n", "<leader>zc", ":CopilotChat<CR>", { desc = "Open Copilot Chat" })
|
||||
-- keymap.set("v", "<leader>ze", ":CopilotChatExplain<CR>", { desc = "Explain code (Copilot Chat)" })
|
||||
-- keymap.set("v", "<leader>zr", ":CopilotChatReview<CR>", { desc = "Review code (Copilot Chat)" })
|
||||
-- keymap.set("v", "<leader>zf", ":CopilotChatFix<CR>", { desc = "Fix code issues (Copilot Chat)" })
|
||||
-- keymap.set("v", "<leader>zo", ":CopilotChatOptimize<CR>", { desc = "Optimize code (Copilot Chat)" })
|
||||
-- keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (Copilot Chat)" })
|
||||
-- keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
||||
-- keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Copilot: Disabled" })
|
||||
-- keymap.set("n", "<leader>cs", ":Copilot status<CR>", { desc = "Copilot: Status" })
|
||||
|
||||
@@ -6,7 +6,7 @@ local fn = vim.fn
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
if ok_dap and ok_dapui then
|
||||
keymap("n", "<leader>dc", dap.continue, { desc = "▶ Start Debugging" })
|
||||
keymap("n", "<leader>dcr", dap.continue, { desc = "▶ Start Debugging" })
|
||||
keymap("n", "<leader>do", dap.step_over, { desc = "⏭ Step Over" })
|
||||
keymap("n", "<leader>di", dap.step_into, { desc = "⤵ Step Into" })
|
||||
keymap("n", "<leader>dot", dap.step_out, { desc = "⤴ Step Out" })
|
||||
|
||||
@@ -6,10 +6,6 @@ local opts = { noremap = true, silent = true }
|
||||
-- GENERAL KEYMAPS
|
||||
-- =============================================================================
|
||||
|
||||
-- Set leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- General keymaps
|
||||
keymap.set("i", "jk", "<ESC>", opts) -- Exit insert mode with jk
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>", opts) -- Clear search highlights
|
||||
|
||||
@@ -3,7 +3,7 @@ local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "]x", "<Plug>(git-conflict-next-conflict)", { desc = "Go to next git conflict" })
|
||||
keymap.set("n", "[x", "<Plug>(git-conflict-prev-conflict)", { desc = "Go to previous git conflict" })
|
||||
keymap.set("n", "<leader>co", "<Plug>(git-conflict-ours)", { desc = "Choose ours (git conflict)" })
|
||||
keymap.set("n", "<leader>coo", "<Plug>(git-conflict-ours)", { desc = "Choose ours (git conflict)" })
|
||||
keymap.set("n", "<leader>ct", "<Plug>(git-conflict-theirs)", { desc = "Choose theirs (git conflict)" })
|
||||
keymap.set("n", "<leader>cb", "<Plug>(git-conflict-both)", { desc = "Choose both (git conflict)" })
|
||||
keymap.set("n", "<leader>c0", "<Plug>(git-conflict-none)", { desc = "Choose none (git conflict)" })
|
||||
|
||||
@@ -5,8 +5,14 @@ local keymap = vim.keymap
|
||||
-- PERSONAL KEYMAPS (ORIGINAL WORKFLOW)
|
||||
-- =============================================================================
|
||||
|
||||
keymap.set("n", "<leader>u", "gg0vG$$", { desc = "Select the whole file open" })
|
||||
keymap.set("n", "<leader>4", "0v$hy<Esc>0o<Esc>0p0kw<CR>", { desc = "Copy the entire line and paste just below" })
|
||||
keymap.set("n", "<leader>u", function()
|
||||
vim.cmd("normal! ggVG")
|
||||
end, { desc = "Select the whole file" })
|
||||
keymap.set("n", "<leader>4", function()
|
||||
-- Copy current line and paste below
|
||||
vim.cmd("normal! yy")
|
||||
vim.cmd("normal! p")
|
||||
end, { desc = "Copy the entire line and paste just below" })
|
||||
|
||||
-- file management
|
||||
keymap.set("n", "<leader>w", ":w<CR>", { desc = "Save the current file" })
|
||||
|
||||
@@ -21,7 +21,7 @@ keymap.set("n", "<leader>gg", "<cmd>LazyGit<CR>", { desc = "LazyGit" })
|
||||
|
||||
-- DAP
|
||||
keymap.set("n", "<leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", { desc = "Toggle breakpoint" })
|
||||
keymap.set("n", "<leader>dc", "<cmd>lua require'dap'.continue()<cr>", { desc = "Continue" })
|
||||
keymap.set("n", "<leader>dcc", "<cmd>lua require'dap'.continue()<cr>", { desc = "Continue" })
|
||||
keymap.set("n", "<leader>di", "<cmd>lua require'dap'.step_into()<cr>", { desc = "Step into" })
|
||||
keymap.set("n", "<leader>do", "<cmd>lua require'dap'.step_over()<cr>", { desc = "Step over" })
|
||||
keymap.set("n", "<leader>dO", "<cmd>lua require'dap'.step_out()<cr>", { desc = "Step out" })
|
||||
@@ -49,8 +49,8 @@ keymap.set("n", "<leader>sr", "<cmd>SessionRestore<cr>", { desc = "Restore sessi
|
||||
-- Formatting
|
||||
keymap.set("n", "<leader>f", "<cmd>lua vim.lsp.buf.format()<cr>", { desc = "Format buffer" })
|
||||
|
||||
-- Substitute
|
||||
keymap.set("n", "<leader>s", "<cmd>lua require('substitute').operator()<cr>", { desc = "Substitute with motion" })
|
||||
-- Substitute (changed from <leader>s to <leader>sub to avoid conflicts)
|
||||
keymap.set("n", "<leader>sub", "<cmd>lua require('substitute').operator()<cr>", { desc = "Substitute with motion" })
|
||||
keymap.set("n", "<leader>ss", "<cmd>lua require('substitute').line()<cr>", { desc = "Substitute line" })
|
||||
keymap.set("n", "<leader>S", "<cmd>lua require('substitute').eol()<cr>", { desc = "Substitute to end of line" })
|
||||
|
||||
@@ -205,4 +205,4 @@ keymap.set("n", "<leader>tC", "<cmd>set formatoptions-=c<cr>", { desc = "Disable
|
||||
-- Indent and wrap
|
||||
keymap.set("n", "<leader>ti", "<cmd>set breakindent!<cr>", { desc = "Toggle break indent" })
|
||||
keymap.set("n", "<leader>ts", "<cmd>set showbreak=↪ <cr>", { desc = "Show break indicator" })
|
||||
keymap.set("n", "<leader>tS", "<cmd>set showbreak=<cr>", { desc = "Hide break indicator" })
|
||||
keymap.set("n", "<leader>tS", "<cmd>set showbreak=<cr>", { desc = "Hide break indicator" })
|
||||
|
||||
@@ -42,6 +42,23 @@ opt.scrolljump = 1 -- Minimal number of screen lines to scroll
|
||||
opt.scrolloff = 3 -- Keep 3 lines above/below cursor (reduced from 8)
|
||||
opt.sidescrolloff = 3 -- Keep 3 columns left/right of cursor (reduced from 8)
|
||||
|
||||
-- Syntax loading optimizations
|
||||
opt.syntax = "on" -- Enable syntax highlighting
|
||||
opt.synmaxcol = 200 -- Reduce syntax highlighting column limit
|
||||
opt.lazyredraw = false -- Don't use lazy redraw (can cause issues)
|
||||
opt.foldmethod = "syntax" -- Use syntax-based folding for better performance
|
||||
opt.foldlevel = 99 -- Don't fold by default
|
||||
|
||||
-- Filetype plugin optimizations
|
||||
opt.filetype = "on" -- Enable filetype detection
|
||||
opt.modeline = false -- Disable modeline for security and performance
|
||||
opt.modelines = 0 -- Disable modelines
|
||||
|
||||
-- Matchparen optimizations
|
||||
g.matchparen_timeout = 100 -- Reduce from default 300ms
|
||||
g.matchparen_insert_timeout = 50 -- Reduce from default 100ms
|
||||
g.matchparen_disable_cursor_hl = 0 -- Keep cursor highlighting but optimize
|
||||
|
||||
-- UI settings
|
||||
opt.number = true -- Show line numbers
|
||||
opt.relativenumber = true -- Show relative line numbers
|
||||
@@ -108,10 +125,27 @@ opt.splitright = true -- Split right when creating vertical splits
|
||||
-- Conceal
|
||||
opt.conceallevel = 2 -- Conceal certain characters
|
||||
|
||||
-- Disable providers that cause warnings
|
||||
-- Provider configurations
|
||||
g.loaded_perl_provider = 0 -- Disable Perl provider
|
||||
g.loaded_ruby_provider = 0 -- Disable Ruby provider (optional)
|
||||
|
||||
-- Python provider configuration
|
||||
g.python3_host_prog = "/opt/homebrew/bin/python3.12" -- Explicit Python path
|
||||
|
||||
-- Clipboard provider optimization (macOS)
|
||||
g.clipboard = {
|
||||
name = 'pbcopy',
|
||||
copy = {
|
||||
['+'] = 'pbcopy',
|
||||
['*'] = 'pbcopy',
|
||||
},
|
||||
paste = {
|
||||
['+'] = 'pbpaste',
|
||||
['*'] = 'pbpaste',
|
||||
},
|
||||
cache_enabled = 1,
|
||||
}
|
||||
|
||||
-- Lua specific settings
|
||||
opt.runtimepath:append(vim.fn.stdpath("config") .. "/lua")
|
||||
|
||||
@@ -171,48 +205,37 @@ for _, plugin in pairs(disabled_built_ins) do
|
||||
end
|
||||
|
||||
-- =============================================================================
|
||||
-- AUTO WRAPPER AUTOCMDS
|
||||
-- OPTIMIZED AUTO WRAPPER AUTOCMDS
|
||||
-- =============================================================================
|
||||
|
||||
-- Set up auto-wrapping for different file types
|
||||
-- Consolidated auto-wrapping configuration
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "text", "markdown", "gitcommit", "mail" },
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt_local.textwidth = 80
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
vim.opt_local.formatoptions:append("t") -- Auto-wrap text
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set up auto-wrapping for code files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "lua", "javascript", "typescript", "python", "java", "cpp", "c", "rust", "go" },
|
||||
callback = function()
|
||||
vim.opt_local.textwidth = 100 -- Longer lines for code
|
||||
vim.opt_local.formatoptions:append("c") -- Auto-wrap comments
|
||||
vim.opt_local.formatoptions:append("r") -- Auto-wrap comments with leader
|
||||
vim.opt_local.formatoptions:append("o") -- Auto-wrap comments with 'o'
|
||||
vim.opt_local.formatoptions:append("q") -- Allow formatting of comments with 'gq'
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set up auto-wrapping for documentation files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help", "man" },
|
||||
callback = function()
|
||||
vim.opt_local.textwidth = 78
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
vim.opt_local.formatoptions:append("t") -- Auto-wrap text
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set up auto-wrapping for configuration files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "conf", "config", "ini", "toml", "yaml", "json" },
|
||||
callback = function()
|
||||
vim.opt_local.textwidth = 80
|
||||
vim.opt_local.formatoptions:append("c") -- Auto-wrap comments
|
||||
local filetype = vim.bo.filetype
|
||||
local opt = vim.opt_local
|
||||
|
||||
-- Text/documentation files
|
||||
if vim.tbl_contains({ "text", "markdown", "gitcommit", "mail", "help", "man" }, filetype) then
|
||||
opt.textwidth = filetype == "help" or filetype == "man" and 78 or 80
|
||||
opt.wrap = true
|
||||
opt.linebreak = true
|
||||
opt.formatoptions:append("t") -- Auto-wrap text
|
||||
end
|
||||
|
||||
-- Code files
|
||||
if vim.tbl_contains({ "lua", "javascript", "typescript", "python", "java", "cpp", "c", "rust", "go" }, filetype) then
|
||||
opt.textwidth = 100 -- Longer lines for code
|
||||
opt.formatoptions:append("c") -- Auto-wrap comments
|
||||
opt.formatoptions:append("r") -- Auto-wrap comments with leader
|
||||
opt.formatoptions:append("o") -- Auto-wrap comments with 'o'
|
||||
opt.formatoptions:append("q") -- Allow formatting of comments with 'gq'
|
||||
end
|
||||
|
||||
-- Configuration files
|
||||
if vim.tbl_contains({ "conf", "config", "ini", "toml", "yaml", "json" }, filetype) then
|
||||
opt.textwidth = 80
|
||||
opt.formatoptions:append("c") -- Auto-wrap comments
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
return {
|
||||
{
|
||||
-- Main Copilot plugin
|
||||
"zbirenbaum/copilot.lua",
|
||||
lazy = false, -- Load at startup
|
||||
enabled = true,
|
||||
config = function()
|
||||
require("copilot").setup({
|
||||
-- General settings
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = false,
|
||||
keymap = {
|
||||
jump_prev = "[[",
|
||||
jump_next = "]]",
|
||||
accept = "<CR>",
|
||||
refresh = "gr",
|
||||
},
|
||||
layout = {
|
||||
position = "bottom", -- | top | left | right | horizontal | vertical
|
||||
ratio = 0.4,
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
debounce = 75,
|
||||
trigger_on_accept = false,
|
||||
keymap = {
|
||||
accept = "<C-l>", -- Accept suggestion
|
||||
next = "<C-j>", -- Next suggestion
|
||||
prev = "<C-k>", -- Previous suggestion
|
||||
dismiss = "<C-x>", -- Dismiss suggestion
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
markdown = true,
|
||||
["*"] = true, -- Enable for all filetypes
|
||||
},
|
||||
copilot_node_command = "node", -- Ensure your system's Node.js is v20+
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- Copilot Chat plugin
|
||||
"CopilotC-Nvim/CopilotChat.nvim",
|
||||
dependencies = {
|
||||
{ "zbirenbaum/copilot.lua" },
|
||||
{ "nvim-lua/plenary.nvim", branch = "master" }, -- For curl, log and async functions
|
||||
},
|
||||
build = "make tiktoken", -- Only on MacOS or Linux
|
||||
opts = {
|
||||
layout = {
|
||||
position = "right", -- Position of the chat window
|
||||
ratio = 0.5,
|
||||
},
|
||||
tiktoken = {
|
||||
enabled = false, -- Enable token counting
|
||||
},
|
||||
floating = {
|
||||
enabled = true,
|
||||
border = "rounded",
|
||||
},
|
||||
prompts = {
|
||||
Rename = {
|
||||
prompt = "Please rename the variable correctly in given selection based on context",
|
||||
selection = function(source)
|
||||
local select = require("CopilotChat.select")
|
||||
return select.visual(source)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
44
lua/cargdev/plugins/curls.lua
Normal file
44
lua/cargdev/plugins/curls.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
return {
|
||||
"CarGDev/rest.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "http")
|
||||
end,
|
||||
},
|
||||
config = function()
|
||||
-- Basic configuration for rest.nvim
|
||||
vim.g.rest_nvim = {
|
||||
-- Enable request highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
timeout = 750,
|
||||
},
|
||||
-- Enable response formatting
|
||||
response = {
|
||||
hooks = {
|
||||
format = true,
|
||||
decode_url = true,
|
||||
},
|
||||
},
|
||||
-- Enable cookies
|
||||
cookies = {
|
||||
enable = true,
|
||||
},
|
||||
-- Enable environment variables
|
||||
env = {
|
||||
enable = true,
|
||||
pattern = ".*%.env.*",
|
||||
},
|
||||
-- UI configuration
|
||||
ui = {
|
||||
winbar = true,
|
||||
keybinds = {
|
||||
prev = "H",
|
||||
next = "L",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
@@ -1 +1,11 @@
|
||||
return { "wakatime/vim-wakatime", lazy = false }
|
||||
return {
|
||||
"wakatime/vim-wakatime",
|
||||
lazy = false,
|
||||
config = function()
|
||||
-- WakaTime performance optimizations
|
||||
vim.g.wakatime_HeartbeatFrequency = 2 -- Increase from default 1 minute to 2 minutes
|
||||
vim.g.wakatime_buffering_heartbeats_enabled = 1 -- Enable buffering
|
||||
vim.g.wakatime_debug = 0 -- Disable debug mode for performance
|
||||
vim.g.wakatime_redraw_setting = 'auto' -- Auto redraw setting
|
||||
end,
|
||||
}
|
||||
|
||||
7846
nvim-profile.log
Normal file
7846
nvim-profile.log
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user