diff --git a/lua/plugins/big_files.lua b/lua/plugins/big_files.lua index 4a4e8e3..deaa172 100644 --- a/lua/plugins/big_files.lua +++ b/lua/plugins/big_files.lua @@ -3,14 +3,26 @@ return { "LunarVim/bigfile.nvim", event = { "BufReadPre", "BufNewFile" }, opts = { - filesize = 0.01, -- 10 KiB (your hive_adapters.g.dart sits right around here) - pattern = { "*.g.dart", "hive_registrar.g.dart" }, -- Force override on generated Dart files + -- Fallback size if the function doesn't intercept it + filesize = 2, + -- Use a detection function to unconditionally catch generated files + pattern = function(bufnr, _) + local buf_name = vim.api.nvim_buf_get_name(bufnr) + if buf_name:match("%.g%.dart$") or buf_name:match("hive_registrar%.g%.dart$") then + -- 1. Hard-disable Autopairs for this specific buffer + vim.api.nvim_buf_set_var(bufnr, "autopairs_enabled", false) + + -- 2. Prevent the Copilot server from attaching and tracking + vim.api.nvim_buf_set_var(bufnr, "copilot_enabled", 0) + return true + end + end, features = { - "indent_blankline", -- Disables heavy indentation lines - "lsp", -- Strips LSP diagnostics and semantic tokens for this buffer - "treesitter", -- Completely disables treesitter parsing/highlighting - "syntax", -- Drops standard heavy syntax engines - "matchparen", -- Stops Neovim from trying to match deeply nested brackets + "indent_blankline", -- Disables heavy indentation lines + "lsp", -- Strips LSP diagnostics and semantic tokens for this buffer + "treesitter", -- Completely disables treesitter parsing/highlighting + "syntax", -- Drops standard heavy syntax engines + "matchparen", -- Stops Neovim from trying to match deeply nested brackets }, }, config = function(_, opts) diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua index 709c40d..3cbef80 100644 --- a/lua/plugins/flutter.lua +++ b/lua/plugins/flutter.lua @@ -9,6 +9,19 @@ return { config = function() vim.opt.termguicolors = true -- vim.env.FLUTTER_FORCE_COLOR = "1" + local project_root = vim.fn.getcwd() + local analysis_excluded_folders = { + project_root .. "/.dart_tool", + project_root .. "/build", + project_root .. "/ios/Pods", + project_root .. "/android/.gradle", + } + local flutter_bin = vim.fn.exepath("flutter") + if flutter_bin ~= "" then + local flutter_sdk = vim.fn.fnamemodify(vim.fn.resolve(flutter_bin), ":h:h") + table.insert(analysis_excluded_folders, flutter_sdk .. "/packages") + table.insert(analysis_excluded_folders, flutter_sdk .. "/.pub-cache") + end -- Auto scroll & Color logs when new logs appear vim.api.nvim_create_autocmd({ "TextChanged", "BufWinEnter" }, { @@ -45,12 +58,16 @@ return { end, settings = { showTodos = true, - completeFunctionCalls = true, + completeFunctionCalls = false, updateImportsOnRename = true, + analysisExcludedFolders = analysis_excluded_folders, }, }, widget_guides = { - enabled = true, + enabled = false, + }, + closing_tags = { + enabled = false, }, dev_log = { enabled = true, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 0189a2b..63f915b 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -114,7 +114,6 @@ return { else fallback() end - fallback() end, }), [""] = cmp.mapping(function(fallback) @@ -126,11 +125,11 @@ return { end, { "i", "s" }), }), sources = cmp.config.sources({ - { name = "nvim_lsp", keyword_length = 1 }, - { name = "luasnip", keyword_length = 1 }, + { name = "nvim_lsp", keyword_length = 2 }, + { name = "luasnip", keyword_length = 2 }, { name = "buffer", - keyword_length = 2, + keyword_length = 3, -- Limit indexing to only the active visible buffer to stop lag on Enter option = { get_bufnrs = function() diff --git a/lua/plugins/oneliners.lua b/lua/plugins/oneliners.lua index 5c6270c..58eda14 100644 --- a/lua/plugins/oneliners.lua +++ b/lua/plugins/oneliners.lua @@ -17,7 +17,8 @@ return { config = function() local autopairs = require("nvim-autopairs") autopairs.setup({ - check_ts = true, + check_ts = false, + map_cr = false, ts_config = { lua = { "string" }, dart = { "string_literal" } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 49d1276..7e107b3 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,15 +1,35 @@ return { - 'nvim-telescope/telescope.nvim', version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - -- optional but recommended - { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, - }, - config = function() - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) - vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) - vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) - vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) - end + 'nvim-telescope/telescope.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + -- optional but recommended + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + }, + config = function() + local telescope = require('telescope') + local builtin = require('telescope.builtin') + + telescope.setup({ + defaults = { + -- The "vimgrep_arguments" here are what make Telescope lag-free + -- when working with large generated codebases. + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--glob=!**/*.g.dart", -- Ignore all .g.dart files + "--glob=!**/hive_registrar.g.dart", -- Specifically ignore your registry + }, + }, + }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) + vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) + vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) + end }