fix lag and add buffer management
This commit is contained in:
parent
9f86c36b7e
commit
e045491ec1
8 changed files with 121 additions and 24 deletions
|
|
@ -5,15 +5,15 @@ return {
|
|||
cmdline = {
|
||||
view = "cmdline_popup", -- This ensures it's a popup and not at the bottom
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = "lsp",
|
||||
kind = "progress",
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
},
|
||||
-- routes = {
|
||||
-- {
|
||||
-- filter = {
|
||||
-- event = "lsp",
|
||||
-- kind = "progress",
|
||||
-- },
|
||||
-- opts = { skip = true },
|
||||
-- },
|
||||
-- },
|
||||
presets = {
|
||||
bottom_search = false, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
|
|
|
|||
16
lua/plugins/early_retirement.lua
Normal file
16
lua/plugins/early_retirement.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"chrisgrieser/nvim-early-retirement",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
ignoreFilenamePattern = "FLUTTER_DEV_LOG",
|
||||
ignoredFiletypes = { "log" },
|
||||
retirementAgeMins = 10,
|
||||
minimumBufferNum = 5,
|
||||
ignoreUnsavedChangesBufs = true,
|
||||
ignoreVisibleBufs = true,
|
||||
ignoreSpecialBuftypes = true,
|
||||
ignoreAltFile = true,
|
||||
notificationOnAutoClose = true,
|
||||
deleteBufferWhenFileDeleted = false,
|
||||
},
|
||||
}
|
||||
|
|
@ -8,14 +8,49 @@ return {
|
|||
},
|
||||
config = function()
|
||||
vim.opt.termguicolors = true
|
||||
vim.api.nvim_create_autocmd({ "TextChanged", "BufWinEnter" }, {
|
||||
pattern = "*__FLUTTER_DEV_LOG__*",
|
||||
callback = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
|
||||
if vim.bo[buf].filetype == "log" or vim.fn.bufname(buf):match("flutter%-dev%.log") then
|
||||
vim.cmd("normal! G")
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "log",
|
||||
callback = function(ev)
|
||||
if not vim.fn.bufname(ev.buf):match("FLUTTER_DEV_LOG") then
|
||||
return
|
||||
end
|
||||
|
||||
if vim.b[ev.buf].flutter_autoscroll_attached then
|
||||
return
|
||||
end
|
||||
vim.b[ev.buf].flutter_autoscroll_attached = true
|
||||
|
||||
local pinned = true
|
||||
|
||||
vim.api.nvim_create_autocmd("WinScrolled", {
|
||||
callback = function()
|
||||
local wins = vim.fn.win_findbuf(ev.buf)
|
||||
for _, win in ipairs(wins) do
|
||||
local info = vim.fn.getwininfo(win)[1]
|
||||
if info then
|
||||
pinned = info.botline >= vim.api.nvim_buf_line_count(ev.buf)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_buf_attach(ev.buf, false, {
|
||||
on_lines = function()
|
||||
if not pinned then
|
||||
return
|
||||
end
|
||||
vim.schedule(function()
|
||||
local line_count = vim.api.nvim_buf_line_count(ev.buf)
|
||||
local wins = vim.fn.win_findbuf(ev.buf)
|
||||
for _, win in ipairs(wins) do
|
||||
pcall(vim.api.nvim_win_set_cursor, win, { line_count, 0 })
|
||||
end
|
||||
end)
|
||||
end,
|
||||
on_detach = function()
|
||||
vim.b[ev.buf].flutter_autoscroll_attached = nil
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -34,18 +69,36 @@ return {
|
|||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
client.server_capabilities.documentOnTypeFormattingProvider = nil
|
||||
-- client.server_capabilities.documentOnTypeFormattingProvider = nil
|
||||
-- client.server_capabilities.diagnosticProvider = nil
|
||||
end,
|
||||
flags = {
|
||||
debounce_text_changes = 150, -- milliseconds
|
||||
},
|
||||
settings = {
|
||||
showTodos = true,
|
||||
completeFunctionCalls = false,
|
||||
showTodos = false,
|
||||
completeFunctionCalls = true,
|
||||
renameFilesWithClasses = "prompt",
|
||||
enableSnippets = true,
|
||||
updateImportsOnRename = true,
|
||||
analysisExcludedFolders = {
|
||||
vim.fn.expand("$HOME/.pub-cache"),
|
||||
vim.fn.expand("$HOME/Git/flutter"),
|
||||
vim.fn.getcwd() .. "/android",
|
||||
vim.fn.getcwd() .. "/app",
|
||||
vim.fn.getcwd() .. "/build",
|
||||
vim.fn.getcwd() .. "/build-dir",
|
||||
vim.fn.getcwd() .. "/flatpak",
|
||||
vim.fn.getcwd() .. "/ios",
|
||||
vim.fn.getcwd() .. "/linux",
|
||||
vim.fn.getcwd() .. "/macos",
|
||||
vim.fn.getcwd() .. "/repo",
|
||||
vim.fn.getcwd() .. "/web",
|
||||
vim.fn.getcwd() .. "/windows",
|
||||
vim.fn.getcwd() .. "/.dart_tool",
|
||||
vim.fn.getcwd() .. "/.flatpak-builder",
|
||||
vim.fn.getcwd() .. "/.idea",
|
||||
},
|
||||
},
|
||||
},
|
||||
widget_guides = {
|
||||
|
|
@ -77,6 +130,8 @@ return {
|
|||
user_command("FEmulators", "FlutterEmulators", {})
|
||||
user_command("FLogs", "FlutterLogToggle", {})
|
||||
user_command("FLogsClear", "FlutterLogClear", {})
|
||||
user_command("FLogs", "FlutterLogToggle", {})
|
||||
user_command("FLspRestart", "lsp restart", {})
|
||||
user_command("FPubGet", "FlutterPubGet", {})
|
||||
user_command("FDevToolsStart", "FlutterDevTools", {})
|
||||
user_command("FDevToolsOpen", "FlutterOpenDevTools", {})
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ return {
|
|||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = ev.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false })
|
||||
vim.lsp.buf.format({ bufnr = ev.buf, async = false })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,21 @@ return {
|
|||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
-- The "vimgrep_arguments" here are what make Telescope lag-free
|
||||
-- when working with large generated codebases.
|
||||
file_ignore_patterns = {
|
||||
"%.dart_tool/",
|
||||
"%.flatpak%-builder/",
|
||||
"%.idea/",
|
||||
"%.git/",
|
||||
"build/",
|
||||
"build%-dir/",
|
||||
"android/",
|
||||
"ios/",
|
||||
"linux/",
|
||||
"macos/",
|
||||
"windows/",
|
||||
"web/",
|
||||
"%.g%.dart$", -- Catches generated files in find_files too
|
||||
},
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue