fix lag with dart lsp

This commit is contained in:
yaso 2026-06-26 12:50:23 +02:00
parent 9297612e84
commit 8b5c66896f
7 changed files with 75 additions and 6 deletions

View file

@ -18,6 +18,26 @@ A pre-configured, performance-oriented Neovim setup designed to get you from zer
The **Leader Key** is set to `Space`.
### Core Motions & Editing
| Action | Keybinding | Description |
| :--- | :--- | :--- |
| **Move Left** | `h` | Move the cursor one character to the left. |
| **Move Down** | `j` | Move the cursor down one line. |
| **Move Up** | `k` | Move the cursor up one line. |
| **Move Right** | `l` | Move the cursor one character to the right. |
| **Word Forward** | `w` | Jump forward to the start of the next word. |
| **Word Backward** | `b` | Jump backward to the start of the previous word. |
| **End of Word** | `e` | Jump forward to the end of the current/next word. |
| **Line Start** | `0` | Jump to the absolute beginning of the current line. |
| **Line End** | `$` | Jump to the end of the current line. |
| **File Top** | `gg` | Jump to the first line of the file. |
| **File Bottom** | `G` | Jump to the last line of the file. |
| **Internal Yank** | `y` | Copy selected text (Visual mode) *inside* Neovim only. |
| **Internal Paste** | `p` | Paste text (Normal mode) last copied/deleted *inside* Neovim. |
| **System Copy** | `<leader>y` |Copy selected text (Visual mode) to the **system clipboard**. |
| **System Paste** | `<leader>p` | Paste text (Normal mode) from the **system clipboard**. |
**Note:** Dashboard keybindings are active only on the dashboard screen and do not require the leader key prefix.
### Dashboard
@ -134,6 +154,8 @@ The **Leader Key** is set to `Space`.
| Action | Keybinding | Description |
| :--- | :--- | :--- |
| **Confirm Completion**| `Enter` | Accept the current suggestion in the popup menu. |
| **Confirm Completion**| `Enter` | Accept the current suggestion in the popup menu. |
| **Confirm Completion**| `Enter` | Accept the current suggestion in the popup menu. |
| **Scroll Docs** | `Ctrl + f / b` | Scroll up/down in the LSP documentation window. |
## Get Started

View file

@ -1,6 +1,10 @@
vim.g.mapleader = " "
-- vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
vim.keymap.set("n", "<leader>;", ":Dashboard<CR>", { desc = "Return to Dashboard", silent = true })
-- Copy visual selection to system clipboard using Leader + y
vim.keymap.set("v", "<leader>y", '"+y', { desc = "Copy to system clipboard" })
-- Paste from system clipboard using Leader + p
vim.keymap.set("n", "<leader>p", '"+p', { desc = "Paste from system clipboard" })
vim.api.nvim_create_autocmd("FileType", {
pattern = "netrw",
callback = function(event)

View file

@ -7,3 +7,5 @@ vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.splitbelow = true -- Opens horizontal splits below
vim.opt.splitright = true -- Opens vertical splits to the right
-- Disable legacy vim bracket matching engine (fixes newline/brace layout latency)
vim.g.loaded_matchparen = 1

View file

@ -40,6 +40,9 @@ return {
},
lsp = {
capabilities = require("cmp_nvim_lsp").default_capabilities(),
on_attach = function(client, bufnr)
client.server_capabilities.semanticTokensProvider = nil
end,
settings = {
showTodos = true,
completeFunctionCalls = true,

View file

@ -107,7 +107,16 @@ return {
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
fallback()
end,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.confirm({ select = true })
@ -117,10 +126,18 @@ return {
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
{ name = "nvim_lsp", keyword_length = 1 },
{ name = "luasnip", keyword_length = 1 },
{
name = "buffer",
keyword_length = 2,
-- Limit indexing to only the active visible buffer to stop lag on Enter
option = {
get_bufnrs = function()
return { vim.api.nvim_get_current_buf() }
end
}
}, -- Triggers after typing 2 characters of a local word
{ name = "path" },
}),
})

View file

@ -14,7 +14,21 @@ return {
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
config = function()
local autopairs = require("nvim-autopairs")
autopairs.setup({
check_ts = true,
ts_config = {
lua = { "string" },
dart = { "string_literal" }
}
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local pcall_cmp, cmp = pcall(require, "cmp")
if pcall_cmp then
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
end
},
}

View file

@ -13,6 +13,13 @@ return {
ts.setup({
install_dir = vim.fn.stdpath("data") .. "/site",
auto_install = true,
highlight = {
enable = true,
},
indent = {
enable = true,
disable = { "dart" },
},
})
-- 2. Bulk Install Parsers (Asynchronous)
ts.install(supported_languages)