fix lag and add buffer management #10
8 changed files with 121 additions and 24 deletions
11
README.md
11
README.md
|
|
@ -150,6 +150,16 @@ The **Leader Key** is set to `Space`.
|
|||
| **Harpoon Find** | `<leader>fl` | Use Telescope to search your Harpoon list. |
|
||||
| **Quick Nav** | `Ctrl + h/t/n/s` | Jump instantly to Harpoon files 1, 2, 3, or 4. |
|
||||
|
||||
### Telescope Navigation & Buffer Management
|
||||
|
||||
| Action | Keybinding | Description |
|
||||
| :--- | :--- | :--- |
|
||||
| **Find Files** | `<leader>ff` | Fuzzy find files in your project.[cite: 3] |
|
||||
| **Live Grep** | `<leader>fg` | Search for specific text across all project files.[cite: 3] |
|
||||
| **Help Tags** | `<leader>fh` | Search through Neovim help documentation.[cite: 3] |
|
||||
| **Active Buffers List** | `<leader>fb` | View, search, and switch between your currently open buffers.[cite: 3] |
|
||||
| **Delete Buffer (Normal Mode)** | `d` | Close the selected buffer after pressing `<Esc>` inside the `<leader>fb` menu. |
|
||||
|
||||
### LSP & Development
|
||||
| Action | Keybinding | Description |
|
||||
| :--- | :--- | :--- |
|
||||
|
|
@ -172,6 +182,7 @@ The **Leader Key** is set to `Space`.
|
|||
| **List Devices** | `:FDevices` | Show a list of available physical/virtual devices. |
|
||||
| **Toggle Logs** | `:FLogs` | Open or close the Flutter Dev Log split. |
|
||||
| **Clear Logs** | `:FLogsClear` | Clear the current Flutter Dev Log buffer. |
|
||||
| **Restart LSP** | `:FLspRestart` | Restart the Dart lsp is not working correctly. |
|
||||
| **Clean Project** | `:FClean` | Execute flutter clean in split terminal. |
|
||||
| **Pub Get** | `:FPubGet` | Fetches project dependencies. |
|
||||
| **Start DevTools** | `:FDevToolsStart` | Start the local Flutter DevTools server |
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "292f44408498103c47996ff5c18fd366293840d8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "d224a1920728ba129880efc700d4a0180ac4ecbb" },
|
||||
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "dad71387de386a946b123079d0e53f23028f3abd" },
|
||||
|
|
@ -31,5 +31,5 @@
|
|||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "2314e0eb074996acc30183e3e9dfbfefd82f24aa" }
|
||||
"yazi.nvim": { "branch": "main", "commit": "8d6c25cb4e7c5702d6cd5a263cb36129fa78aa4c" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ vim.keymap.set("v", "<leader>y", '"+y', { desc = "Copy to system clipboard" })
|
|||
vim.keymap.set({ "n", "v" }, "<leader>p", '"+p', { desc = "Paste from system clipboard after" })
|
||||
-- Paste from system clipboard BEFORE the cursor (Normal & Visual mode)
|
||||
vim.keymap.set({ "n", "v" }, "<leader>P", '"+P', { desc = "Paste from system clipboard before" })
|
||||
-- Native LSP restart keymap (No plugins or custom functions required!)
|
||||
vim.keymap.set("n", "<leader>lx", "<cmd>lsp restart<CR>", { desc = "Restart LSP Server" })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "netrw",
|
||||
callback = function(event)
|
||||
|
|
|
|||
|
|
@ -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