From 3af68c2c76a576b4251bdd544ccdec497a69581e Mon Sep 17 00:00:00 2001 From: Raoul Branten Date: Tue, 23 Dec 2025 14:04:07 +0100 Subject: [PATCH] pre-ai-alter --- CURSOR_COMPLETION.md | 103 +++++++++++++++ README.md | 144 ++++++++++++++++++++ init.lua | 1 + lua/config/cmp-cursor.lua | 161 +++++++++++++++++++++++ lua/config/keymaps.lua | 27 ++-- lua/config/options.lua | 17 ++- lua/config/plugin/cmp.lua | 81 ++++++++++++ lua/config/plugin/indent-blankline.lua | 34 +++-- lua/config/plugin/init.lua | 3 +- lua/config/plugin/rainbow-delimiters.lua | 31 ++++- lua/plugins/init.lua | 15 +++ 11 files changed, 589 insertions(+), 28 deletions(-) create mode 100644 CURSOR_COMPLETION.md create mode 100644 README.md create mode 100644 lua/config/cmp-cursor.lua create mode 100644 lua/config/plugin/cmp.lua diff --git a/CURSOR_COMPLETION.md b/CURSOR_COMPLETION.md new file mode 100644 index 0000000..1e70be6 --- /dev/null +++ b/CURSOR_COMPLETION.md @@ -0,0 +1,103 @@ +# Cursor Autocompletion for Neovim + +This setup integrates Cursor's AI-powered autocompletion into Neovim using `cursor-agent` CLI and `nvim-cmp`. + +## Features + +- **AI-powered completions**: Get intelligent code completions powered by Cursor's AI +- **Context-aware**: Uses surrounding code context (last 30 lines) for better suggestions +- **Integrated with nvim-cmp**: Works seamlessly with other completion sources (LSP, snippets, buffer, etc.) +- **Prioritized suggestions**: Cursor completions appear at the top of the completion menu + +## Setup + +The integration is already configured! Just make sure: + +1. **cursor-agent CLI is installed and authenticated**: + ```bash + cursor-agent status + ``` + If not authenticated, run: + ```bash + cursor-agent login + ``` + +2. **Restart Neovim** to load the new configuration + +3. **Install plugins** (if using lazy.nvim, they'll auto-install): + ```vim + :Lazy sync + ``` + +## Usage + +1. **Start typing** in any file +2. **Press ``** to trigger completion manually, or wait for automatic triggers +3. **Look for `[Cursor]`** in the completion menu to see AI suggestions +4. **Navigate** with ``/`` and **accept** with `` + +## Configuration + +### Keybindings + +Default keybindings (can be customized in `lua/config/plugin/cmp.lua`): +- `` - Trigger completion +- `` - Next completion item / Expand snippet +- `` - Previous completion item / Jump snippet backward +- `` - Confirm completion +- `` - Close completion menu + +### Adjusting Completion Behavior + +Edit `lua/plugins/cmp-cursor.lua` to customize: +- **Context window**: Change `line_num - 30` to adjust how many lines of context are sent +- **Minimum trigger length**: Change `#before_cursor:gsub('%s+', '') < 3` to require more/less context +- **Timeout**: Change `8000` (8 seconds) to adjust how long to wait for completions + +### Disabling Cursor Completions + +To temporarily disable Cursor completions, comment out the cursor source in `lua/config/plugin/cmp.lua`: + +```lua +sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + -- { name = 'cursor', source = cursor_completion_source }, -- Disabled + { name = 'luasnip' }, +}, { +``` + +## How It Works + +1. When you trigger completion, the plugin captures: + - Current line up to cursor position + - Last 30 lines of context + - File content + +2. It sends a prompt to `cursor-agent --print` asking for completion suggestions + +3. The AI response is parsed and formatted as completion items + +4. These appear in the nvim-cmp completion menu with `[Cursor]` label + +## Troubleshooting + +**No Cursor completions appearing:** +- Check `cursor-agent status` to ensure you're authenticated +- Verify `cursor-agent` is in your PATH: `which cursor-agent` +- Check Neovim messages: `:messages` for any errors + +**Completions are slow:** +- This is expected - AI completions take 2-8 seconds +- Consider increasing the minimum trigger length to reduce API calls +- The timeout is set to 8 seconds + +**Completions don't make sense:** +- The AI uses context from your file - ensure you have meaningful code before the cursor +- Try typing more context before triggering completion + +## Notes + +- Cursor completions use API credits from your Cursor account +- Completions are generated on-demand, not cached +- The integration works best with code files (not plain text) +- For best results, ensure your code is syntactically correct before requesting completions diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f16e0a --- /dev/null +++ b/README.md @@ -0,0 +1,144 @@ +# Neovim Configuration Summary + +## Plugin Management +- **Plugin Manager**: `lazy.nvim` (auto-bootstrapped) +- **Leader Key**: `` +- **Update Checker**: Enabled (silent notifications) + +## Core Plugins & Features + +### File Navigation & Search +- **Telescope** (v0.1.8): Fuzzy finder for files, buffers, grep, help tags, marks +- **nvim-tree**: File browser +- **Tagbar**: Code structure viewer (properties/methods) + +### LSP & Code Intelligence +- **Mason + Mason-LSPConfig**: LSP server management +- **nvim-lspconfig**: LSP client configuration +- **Lspsaga**: Enhanced LSP UI (code actions, definitions, diagnostics, outline) +- **nvim-cmp**: Completion engine with: + - Buffer, path, LSP, cmdline sources + - LuaSnip snippets + - Custom Cursor AI completion source (`cursor-agent` integration) + +### Syntax & Highlighting +- **nvim-treesitter**: Syntax highlighting via language parsers +- **nvim-colorizer**: Color previews (hex codes, etc.) +- **SyntaxAttr**: Display syntax highlighting info +- **Gruvbox**: Colorscheme + +### UI Enhancements +- **lualine**: Status bar +- **nvim-scrollbar**: Scrollbar indicator +- **indent-blankline**: Indentation guides +- **rainbow-delimiters**: Color-coded brackets/braces +- **deadcolumn**: Visual indicator near line limit +- **alpha-nvim**: Custom welcome screen + +### Git Integration +- **vim-fugitive**: Git wrapper +- **vim-gitgutter**: Git diff indicators in gutter + +### Code Quality & Formatting +- **conform.nvim**: Code formatter (configured for Lua with stylua) +- **Trouble.nvim**: Diagnostics viewer + +### Marks & Navigation +- **marks.nvim**: Visual marks with gutter indicators +- **vim-indentwise**: Indentation-based navigation + +### Other Utilities +- **undotree**: Visual undo history +- **which-key.nvim**: Keybinding help menu +- **toggleterm.nvim**: Floating terminal +- **llama.vim**: Local AI integration (requires llama.cpp with CUDA) +- **mini.nvim**: Mini utilities collection +- **volt/menu**: Context menu system +- **minty**: Color picker + +## Key Bindings + +### Telescope (`f`) +- `ff` - Find files +- `fg` - Live grep +- `fb` - Find buffers +- `fc` - Find in current buffer +- `fh` - Help tags +- `fm` - Marks +- `fr` - Resume last search + +### LSP (`l`) +- `lc` - Code actions +- `lo` - Outline +- `lr` - Rename +- `ld` - Go to definition +- `lf` - LSP finder +- `lp` - Preview definition +- `lw` - Workspace diagnostics +- `lb` - Buffer diagnostics +- `lm` - LMS fixer (custom) + +### Other Important Bindings +- `u` - Undo tree +- `m` - Marks management +- `t` - Tab navigation +- `b` - Buffer management +- `i` - Indentation toggles +- `n` - Remove search highlight +- `e` - Show diagnostic +- `` - Definition in new tab +- `` - Tagbar toggle +- `` - LSP hover +- `` - Jump to definition in new tab +- `/` - Tab navigation +- `` - Window navigation +- `` - Move split to tab +- `` - Context menu + +## Editor Settings + +### Display +- True color support enabled +- Cursor line/column highlighting +- Line numbers +- Color column at 81 +- Scroll offset: 5 lines +- Sign column always visible + +### Indentation & Formatting +- Expand tabs to spaces +- Tab width: 4 spaces +- Smart indentation +- Show whitespace characters (eol, tabs, trails) +- No text wrapping + +### Search +- Case-insensitive (smart case) +- Incremental search +- Highlight search results +- Wildignore case enabled + +### Folding +- Method: indent +- Fold level: 99 (mostly open) +- Fold column visible + +### Behavior +- Auto-read changed files +- Arrow keys disabled (forces hjkl) +- Mouse disabled +- Shell commands run interactively (`-ic` flag) + +## Special Features +1. **Cursor AI Integration**: Custom completion source using `cursor-agent` for AI-powered completions +2. **PHP Helper**: Custom function for inserting debug backtraces +3. **Custom Aliases**: `Bufdel` command for buffer management +4. **Quick Directory Navigation**: Shortcuts to LMS project directories (`c`) + +## Architecture +- Modular structure: config split into logical files +- Plugin configs in `lua/config/plugin/` +- Main entry point: `init.lua` +- Uses Lua-based configuration throughout + +This setup focuses on productivity with LSP integration, AI-assisted completion, and a clean UI. diff --git a/init.lua b/init.lua index d1ef06a..a03c602 100644 --- a/init.lua +++ b/init.lua @@ -5,4 +5,5 @@ require("config.lazy") require("config.keymaps") require("config.options") require("config.aliases") +require("config.cmp-cursor") require("config.plugin") diff --git a/lua/config/cmp-cursor.lua b/lua/config/cmp-cursor.lua new file mode 100644 index 0000000..3a6c945 --- /dev/null +++ b/lua/config/cmp-cursor.lua @@ -0,0 +1,161 @@ +-- Custom nvim-cmp source for Cursor Agent autocompletion +local cmp = require('cmp') +local source = {} + +source.new = function() + return setmetatable({}, { __index = source }) +end + +source.is_available = function() + -- Check if cursor-agent is available + return vim.fn.executable('cursor-agent') == 1 +end + +source.get_trigger_characters = function() + return {} +end + +source.complete = function(self, request, callback) + -- Only trigger if there's meaningful context (at least 3 characters typed) + local bufnr = request.context.bufnr + local cursor = vim.api.nvim_win_get_cursor(0) + local line_num = cursor[1] + local col_num = cursor[2] + 1 -- Convert to 1-indexed + + -- Get current line and context + local current_line = vim.api.nvim_buf_get_lines(bufnr, line_num - 1, line_num, false)[1] or '' + local before_cursor = current_line:sub(1, col_num - 1) + + -- Skip if too little context (less than 3 characters before cursor) + if #before_cursor:gsub('%s+', '') < 3 then + callback({ items = {} }) + return + end + + -- Get surrounding context (last 30 lines for better context) + local start_line = math.max(0, line_num - 30) + local context_lines = vim.api.nvim_buf_get_lines(bufnr, start_line, line_num, false) + local context = table.concat(context_lines, '\n') + + -- Build prompt for cursor-agent - optimized for completion + local prompt = string.format( + "Complete the code after the cursor. Return ONLY the text that should appear after the cursor position, nothing else. Do not include any explanation or the existing code.\n\nContext:\n%s\n\nComplete after cursor (|): %s|", + context, + before_cursor + ) + + -- Call cursor-agent with --print flag + local cmd = { + 'cursor-agent', + '--print', + '--output-format', 'text', + prompt + } + + local completed = false + local job_id = vim.fn.jobstart(cmd, { + stdout_buffered = true, + stderr_buffered = true, + on_stdout = function(_, data, _) + if completed then return end + completed = true + + if not data or #data == 0 then + callback({ items = {} }) + return + end + + -- Parse completion suggestions + local items = {} + local full_text = table.concat(data, '\n'):gsub('%s+', ' '):gsub('^%s+', ''):gsub('%s+$', '') + + if full_text and full_text ~= '' then + -- Try to extract just the completion part + -- Remove any text that matches the before_cursor context + local completion = full_text + + -- Clean up common prefixes that might be repeated + if before_cursor ~= '' then + local escaped_prefix = vim.pesc(before_cursor:match('[%w_]+$') or '') + if escaped_prefix ~= '' then + completion = completion:gsub('^' .. escaped_prefix, '') + end + end + + -- Split into potential multiple completions (by lines or common patterns) + if completion:find('\n') then + -- Multiple lines - create separate items + for line in completion:gmatch('[^\n]+') do + line = line:gsub('^%s+', ''):gsub('%s+$', '') + if line ~= '' and #line > 0 then + table.insert(items, { + label = line, + kind = cmp.lsp.CompletionItemKind.Text, + documentation = { + kind = 'markdown', + value = '**Cursor AI Completion**\n\n' .. line + }, + sortText = '0' .. line, -- Prioritize Cursor completions + }) + end + end + else + -- Single line completion + completion = completion:gsub('^%s+', ''):gsub('%s+$', '') + if completion ~= '' and #completion > 0 then + -- Create multiple suggestions: full completion, first word, etc. + table.insert(items, { + label = completion, + kind = cmp.lsp.CompletionItemKind.Text, + documentation = { + kind = 'markdown', + value = '**Cursor AI Completion**\n\n' .. completion + }, + sortText = '0' .. completion, + }) + + -- Also add first word/phrase as a shorter option + local first_part = completion:match('^([%w_]+)') or completion:match('^([^%s]+)') + if first_part and first_part ~= completion and #first_part > 2 then + table.insert(items, { + label = first_part, + kind = cmp.lsp.CompletionItemKind.Text, + documentation = { + kind = 'markdown', + value = '**Cursor AI Completion** (partial)\n\n' .. first_part + }, + sortText = '1' .. first_part, + }) + end + end + end + end + + callback({ items = items }) + end, + on_stderr = function(_, data, _) + if completed then return end + completed = true + -- On error, return empty completions + callback({ items = {} }) + end, + on_exit = function(_, code, _) + if completed then return end + completed = true + if code ~= 0 then + callback({ items = {} }) + end + end + }) + + -- Set timeout (8 seconds for AI completion) + vim.defer_fn(function() + if not completed and vim.fn.jobwait({ job_id }, 0)[1] == -1 then + vim.fn.jobstop(job_id) + completed = true + callback({ items = {} }) + end + end, 8000) +end + +return source diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 284e51f..d18c4cd 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -20,9 +20,9 @@ wk.add({ { "lr", "Lspsaga rename", desc = "Rename", mode ="n"}, { "ld", "Lspsaga goto_definition", desc = "Lsp GoTo Definition", mode ="n"}, { "lf", "Lspsaga finder", desc = "Lsp Finder", mode ="n"}, - { "lp", "Lspsaga preview_definition", desc = "Preview Definition", mode ="n"}, - { "ls", "Lspsaga signature_help", desc = "Signature Help", mode ="n"}, + { "lp", "Lspsaga peek_definition", desc = "Preview Definition", mode ="n"}, { "lw", "Lspsaga show_workspace_diagnostics", desc = "Show Workspace Diagnostics", mode ="n"}, + { "lb", "Lspsaga show_buf_diagnostics", desc = "Show Buffer Diagnostics", mode ="n"}, { "lm", "TermExec cmd='lmsfixfile %:p:h' direction='float'", desc = "LMS fixer this file", mode ="n"}, -- UndoTree { "u", group = "UndoTree" }, @@ -39,27 +39,27 @@ wk.add({ { "Z", group = "Closing"}, { "ZZ", "wq!", desc = "Write en close", mode = "n"}, { "ZQ", "q!", desc = "Close without write", mode = "n"}, - -- Marks - { "m", group = "Marks"}, + -- Creating and browsing marks + { "m", group = "Create / Jump mark"}, { "mx", marks.set, desc = "Set mark [x]", mode = "n"}, { "m,", marks.set_next, desc = "Set the next available alphabetical (lowercase) mark", mode = "n"}, { "m;", marks.toggle, desc = "Toggle the next available mark at the current line", mode = "n"}, - { "dmx", marks.delete, desc = "Delete mark x", mode = "n"}, - { "dm-", marks.delete_line, desc = "Delete all marks on the current line", mode = "n"}, - { "dm", marks.delete_buf, desc = "Delete all marks in the current buffer", mode = "n"}, { "m]", marks.next, desc = "Move to next mark", mode = "n"}, { "m[", marks.prev, desc = "Move to previous mark", mode = "n"}, { "m:", marks.preview, desc = "Preview mark. This will prompt you for a specific mark to preview; press to preview the next mark.", mode = "n"}, { "m[0-9]", marks.set_bookmark, desc = "Add a bookmark from bookmark group[0-9].", mode = "n"}, - { "dm[0-9]", marks.delete_bookmark, desc = "Delete all bookmarks from bookmark group[0-9].", mode = "n"}, { "m}", marks.next_bookmark, desc = "Move to the next bookmark having the same type as the bookmark under the cursor. Works across buffers.", mode = "n"}, { "m{", marks.prev_bookmark, desc = "Move to the previous bookmark having the same type as the bookmark under the cursor. Works across buffers.", mode = "n"}, + -- Deleting marks + { "s", group = "Delete marks"}, + { "dmx", marks.delete, desc = "Delete mark x", mode = "n"}, + { "dm-", marks.delete_line, desc = "Delete all marks on the current line", mode = "n"}, + { "dm", marks.delete_buf, desc = "Delete all marks in the current buffer", mode = "n"}, { "dm=", marks.delete_bookmark, desc = "Delete the bookmark under the cursor.", mode = "n"}, + { "dm[0-9]", marks.delete_bookmark, desc = "Delete all bookmarks from bookmark group[0-9].", mode = "n"}, -- Git { "h", group = "Git"}, - -- Diagnostics - { "h", group = "Code Diagnostics"}, - -- Diagnostics + -- Tabs { "t", group = "Tabs"}, { "tf", "tabm 0", desc = "Move before first tab", mode = "n"}, { "tl", "tabm", desc = "Move after last tab", mode = "n"}, @@ -77,6 +77,11 @@ wk.add({ { "i", group = "Indentation"}, { "it", "IBLToggle", desc = "Toggle indentation guides", mode = "n"}, { "im", "set list!", desc = "Toggle indentation characters", mode = "n"}, + -- Navigation + { "c", group = "Quick change directories"}, + { "cr", "cd ~/lms/", desc = "Change to lms root", mode = "n"}, + { "cc", "cd ~/lms/App/Lms/", desc = "Change to App/Lms", mode = "n"}, + { "ct", "cd ~/lms/Tests/", desc = "Change to Tests", mode = "n"}, }) -- prevent using arrow keys or mouse diff --git a/lua/config/options.lua b/lua/config/options.lua index 5d2dc02..a86ac50 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -43,6 +43,17 @@ vim.opt.wildignorecase = true -- running interactive shell commands vim.opt.shellcmdflag = '-ic' --- system clipboard --- this was pretty annoying ---vim.opt.clipboard = 'unnamedplus' +-- folding +vim.opt.foldmethod = 'indent' +vim.opt.foldcolumn = '1' +vim.opt.foldlevel = 99 +vim.opt.foldlevelstart = 99 +vim.opt.foldenable = true + +--vim.opt.foldlevelstart=99 +--vim.opt.foldlevel=99 +-- +--vim.opt.foldmethod = 'expr' +--vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +--vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()" + diff --git a/lua/config/plugin/cmp.lua b/lua/config/plugin/cmp.lua new file mode 100644 index 0000000..0a4f7c2 --- /dev/null +++ b/lua/config/plugin/cmp.lua @@ -0,0 +1,81 @@ +-- nvim-cmp configuration with Cursor Agent completion source +local cmp = require('cmp') +local luasnip = require('luasnip') + +-- Register custom Cursor completion source +local cursor_source = require('config.cmp-cursor') +cmp.register_source('cursor', cursor_source.new()) + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'cursor' }, -- Custom Cursor source (registered above) + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + { name = 'path' }, + }), + + formatting = { + format = function(entry, vim_item) + vim_item.menu = ({ + nvim_lsp = '[LSP]', + cursor = '[Cursor]', + luasnip = '[Snippet]', + buffer = '[Buffer]', + path = '[Path]', + })[entry.source.name] + return vim_item + end, + }, +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore) +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore) +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) diff --git a/lua/config/plugin/indent-blankline.lua b/lua/config/plugin/indent-blankline.lua index 09ce098..850f6f2 100644 --- a/lua/config/plugin/indent-blankline.lua +++ b/lua/config/plugin/indent-blankline.lua @@ -1,4 +1,11 @@ local highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", "RainbowRed", "RainbowYellow", "RainbowBlue", @@ -7,18 +14,27 @@ local highlight = { "RainbowViolet", "RainbowCyan", } - local hooks = require "ibl.hooks" -- create the highlight groups in the highlight setup hook, so they are reset -- every time the colorscheme changes hooks.register(hooks.type.HIGHLIGHT_SETUP, function() - vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#CC241D" }) - vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#D79921" }) - vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#458588" }) - vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D65D0E" }) - vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98971A" }) - vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#B16286" }) - vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#689D6A" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowDelimiterCyan", { fg = "#56B6C2" }) + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) end) -require("ibl").setup { indent = { highlight = highlight } } +vim.g.rainbow_delimiters = { highlight = highlight } +require("ibl").setup { scope = { highlight = highlight } } + +hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) diff --git a/lua/config/plugin/init.lua b/lua/config/plugin/init.lua index ecc7ef9..11b587c 100644 --- a/lua/config/plugin/init.lua +++ b/lua/config/plugin/init.lua @@ -8,10 +8,11 @@ require("config.plugin.vim-gitgutter") require("config.plugin.deadcolumn") require("config.plugin.colorizer") require("config.plugin.synattr") -require("config.plugin.rainbow-delimiters") require("config.plugin.marks") require("config.plugin.vim-indentwise") +require("config.plugin.rainbow-delimiters") require("config.plugin.indent-blankline") require("config.plugin.scrollbar") require("config.plugin.lspsaga") require("config.plugin.gruvbox") +require("config.plugin.cmp") diff --git a/lua/config/plugin/rainbow-delimiters.lua b/lua/config/plugin/rainbow-delimiters.lua index 9ef210e..956ff06 100644 --- a/lua/config/plugin/rainbow-delimiters.lua +++ b/lua/config/plugin/rainbow-delimiters.lua @@ -1,15 +1,40 @@ -- This module contains a number of default definitions local rainbow_delimiters = require 'rainbow-delimiters' +--vim.g.rainbow_delimiters = { +-- strategy = { +-- [''] = rainbow_delimiters.strategy['global'], +-- commonlisp = rainbow_delimiters.strategy['local'], +-- }, +-- query = { +-- [''] = 'rainbow-delimiters', +-- lua = 'rainbow-blocks', +-- }, +-- --highlight = { +-- -- 'RainbowRed', +-- -- 'RainbowYellow', +-- -- 'RainbowBlue', +-- -- 'RainbowOrange', +-- -- 'RainbowGreen', +-- -- 'RainbowViolet', +-- -- 'RainbowCyan', +-- --}, +-- blacklist = {'c', 'cpp'}, +--} + vim.g.rainbow_delimiters = { strategy = { - [''] = rainbow_delimiters.strategy['global'], - commonlisp = rainbow_delimiters.strategy['local'], + [''] = 'rainbow-delimiters.strategy.global', + vim = 'rainbow-delimiters.strategy.local', }, query = { [''] = 'rainbow-delimiters', lua = 'rainbow-blocks', }, + priority = { + [''] = 110, + lua = 210, + }, highlight = { 'RainbowDelimiterRed', 'RainbowDelimiterYellow', @@ -19,6 +44,4 @@ vim.g.rainbow_delimiters = { 'RainbowDelimiterViolet', 'RainbowDelimiterCyan', }, - blacklist = {'c', 'cpp'}, } - diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 75745e2..fb95437 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -196,6 +196,21 @@ return { version = "*", config = true }, + -- Completion framework + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + }, + config = function() + require("config.plugin.cmp") + end, + }, -- AI -- { -- "supermaven-inc/supermaven-nvim",