From 1aa0e3034d6628289c7d6a115aef78aa139ed5d8 Mon Sep 17 00:00:00 2001 From: Ward Truyen Date: Mon, 2 Jun 2025 15:05:56 +0200 Subject: [PATCH] small comment updates --- lua/ward/plugins/autocomplete.lua | 2 +- lua/ward/plugins/gitsigns.lua | 1 + lua/ward/plugins/lsp-config.lua | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lua/ward/plugins/autocomplete.lua b/lua/ward/plugins/autocomplete.lua index 6d5f4c3..6d1d51e 100644 --- a/lua/ward/plugins/autocomplete.lua +++ b/lua/ward/plugins/autocomplete.lua @@ -1,4 +1,4 @@ ---$ autocomplete for C++ Rust and Lua +--$ autocomplete for C++, Rust, Lua, etc --$ URL: https://github.com/hrsh7th/nvim-cmp --$ help: nvim-cmp return { diff --git a/lua/ward/plugins/gitsigns.lua b/lua/ward/plugins/gitsigns.lua index d8a22d1..fbaa5d2 100644 --- a/lua/ward/plugins/gitsigns.lua +++ b/lua/ward/plugins/gitsigns.lua @@ -1,3 +1,4 @@ +--Note: this will show what part of a file was changed deleted or added in a git repo return { "lewis6991/gitsigns.nvim", -- event = "BufReadPre", diff --git a/lua/ward/plugins/lsp-config.lua b/lua/ward/plugins/lsp-config.lua index 62c7bfe..6fb3456 100644 --- a/lua/ward/plugins/lsp-config.lua +++ b/lua/ward/plugins/lsp-config.lua @@ -1,3 +1,5 @@ +-- NOTE: this adds a Language Server Provider for source files like C++, Java/-Script, etc. +-- It will check the code for errors, warnings, variables and structures and give suggestions. return { "neovim/nvim-lspconfig", version = "*", @@ -30,6 +32,9 @@ return { "clangd", "--offset-encoding=utf-16", }, + init_options = { + fllbackFlags = { '-std=c++20' }, + }, handlers = handlers, }) @@ -88,6 +93,11 @@ return { -- To jump back, press . map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + + -- Find references for the word under your cursor. map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") @@ -100,6 +110,11 @@ return { -- the definition of its *type*, not where it was *defined*. map("ld", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition") + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map("lD", vim.lsp.buf.declaration, "Go to [D]eclaration") + -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. map("ls", require("telescope.builtin").lsp_document_symbols, "document [S]ymbols") @@ -134,10 +149,6 @@ return { -- Opens a popup that displays documentation about the word under your cursor -- See `:help K` for why this keymap. - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") - map("th", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) end, "[T]oggle Inlay [H]ints")