Merge pull request 'fix lag with dart lsp' (#2) from lsp-lag-fix into main
Reviewed-on: #2
This commit is contained in:
commit
7dcec51e2d
7 changed files with 75 additions and 6 deletions
22
README.md
22
README.md
|
|
@ -18,6 +18,26 @@ A pre-configured, performance-oriented Neovim setup designed to get you from zer
|
||||||
|
|
||||||
The **Leader Key** is set to `Space`.
|
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.
|
**Note:** Dashboard keybindings are active only on the dashboard screen and do not require the leader key prefix.
|
||||||
|
|
||||||
### Dashboard
|
### Dashboard
|
||||||
|
|
@ -134,6 +154,8 @@ The **Leader Key** is set to `Space`.
|
||||||
| Action | Keybinding | Description |
|
| 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. |
|
||||||
|
| **Confirm Completion**| `Enter` | Accept the current suggestion in the popup menu. |
|
||||||
| **Scroll Docs** | `Ctrl + f / b` | Scroll up/down in the LSP documentation window. |
|
| **Scroll Docs** | `Ctrl + f / b` | Scroll up/down in the LSP documentation window. |
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
-- vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
|
-- vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
|
||||||
vim.keymap.set("n", "<leader>;", ":Dashboard<CR>", { desc = "Return to Dashboard", silent = true })
|
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", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "netrw",
|
pattern = "netrw",
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,5 @@ vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
vim.opt.splitbelow = true -- Opens horizontal splits below
|
vim.opt.splitbelow = true -- Opens horizontal splits below
|
||||||
vim.opt.splitright = true -- Opens vertical splits to the right
|
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
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,9 @@ return {
|
||||||
},
|
},
|
||||||
lsp = {
|
lsp = {
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
client.server_capabilities.semanticTokensProvider = nil
|
||||||
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
showTodos = true,
|
showTodos = true,
|
||||||
completeFunctionCalls = true,
|
completeFunctionCalls = true,
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,16 @@ return {
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<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)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.confirm({ select = true })
|
cmp.confirm({ select = true })
|
||||||
|
|
@ -117,10 +126,18 @@ return {
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp", keyword_length = 1 },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip", keyword_length = 1 },
|
||||||
}, {
|
{
|
||||||
{ name = "buffer" },
|
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" },
|
{ name = "path" },
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,21 @@ return {
|
||||||
{
|
{
|
||||||
'windwp/nvim-autopairs',
|
'windwp/nvim-autopairs',
|
||||||
event = "InsertEnter",
|
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
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ return {
|
||||||
ts.setup({
|
ts.setup({
|
||||||
install_dir = vim.fn.stdpath("data") .. "/site",
|
install_dir = vim.fn.stdpath("data") .. "/site",
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
disable = { "dart" },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
-- 2. Bulk Install Parsers (Asynchronous)
|
-- 2. Bulk Install Parsers (Asynchronous)
|
||||||
ts.install(supported_languages)
|
ts.install(supported_languages)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue