diff --git a/README.md b/README.md index cd94a6f..a626387 100644 --- a/README.md +++ b/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`. +### 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** | `y` |Copy selected text (Visual mode) to the **system clipboard**. | +| **System Paste** | `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 diff --git a/lua/config/keybinds.lua b/lua/config/keybinds.lua index 46279a5..f03bab3 100644 --- a/lua/config/keybinds.lua +++ b/lua/config/keybinds.lua @@ -1,6 +1,10 @@ vim.g.mapleader = " " -- vim.keymap.set("n", "cd", vim.cmd.Ex) vim.keymap.set("n", ";", ":Dashboard", { desc = "Return to Dashboard", silent = true }) +-- Copy visual selection to system clipboard using Leader + y +vim.keymap.set("v", "y", '"+y', { desc = "Copy to system clipboard" }) +-- Paste from system clipboard using Leader + p +vim.keymap.set("n", "p", '"+p', { desc = "Paste from system clipboard" }) vim.api.nvim_create_autocmd("FileType", { pattern = "netrw", callback = function(event) diff --git a/lua/config/options.lua b/lua/config/options.lua index cae66cd..54191a6 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -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 diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua index 25913ad..709c40d 100644 --- a/lua/plugins/flutter.lua +++ b/lua/plugins/flutter.lua @@ -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, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 603a3ee..0189a2b 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -107,7 +107,16 @@ return { }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.complete(), - [""] = cmp.mapping.confirm({ select = true }), + [""] = 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, + }), [""] = 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" }, }), }) diff --git a/lua/plugins/oneliners.lua b/lua/plugins/oneliners.lua index 1565492..5c6270c 100644 --- a/lua/plugins/oneliners.lua +++ b/lua/plugins/oneliners.lua @@ -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 }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 49abeaa..e2f282c 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -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)