From e945588f4e66f3921f1e233dbeb04fb0abd59a42 Mon Sep 17 00:00:00 2001 From: Grayson Butcher Date: Wed, 24 Sep 2025 11:17:37 -0600 Subject: [PATCH 1/2] 09/24/2025 --- init.lua | 154 +++++++++++++++++++++++++++++- lua/autopairs-config.lua | 35 +++++++ lua/custom/plugins/init.lua | 19 +++- lua/kickstart/plugins/copilot.lua | 5 + lua/plugins.lua | 106 ++++++++++++++++++++ pack/github/start/copilot.vim | 1 + 6 files changed, 314 insertions(+), 6 deletions(-) create mode 100644 lua/autopairs-config.lua create mode 100644 lua/kickstart/plugins/copilot.lua create mode 100644 lua/plugins.lua create mode 160000 pack/github/start/copilot.vim diff --git a/init.lua b/init.lua index cbf9ff65d67..c9cd20d4775 100644 --- a/init.lua +++ b/init.lua @@ -50,7 +50,6 @@ Kickstart Guide: - : - Tutor - - (If you already know the Neovim basics, you can skip this step.) Once you've completed that, you can continue working through **AND READING** the rest @@ -102,7 +101,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -156,6 +155,52 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +local mode_disabled = false +local filetype_disabled = false + +local function check_eof_scrolloff() + if mode_disabled or filetype_disabled then + return + end + + local win_height = vim.api.nvim_win_get_height(0) + local win_view = vim.fn.winsaveview() + local scrolloff = math.min(vim.o.scrolloff, math.floor(win_height / 2)) + local scrolloff_line_count = win_height - (vim.fn.line 'w$' - win_view.topline + 1) + local distance_to_last_line = vim.fn.line '$' - win_view.lnum + + if distance_to_last_line < scrolloff and scrolloff_line_count + distance_to_last_line < scrolloff then + win_view.topline = win_view.topline + scrolloff - (scrolloff_line_count + distance_to_last_line) + vim.fn.winrestview(win_view) + end +end + +vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + pattern = '*', + callback = check_eof_scrolloff, +}) + +-- Grayson - Set the width of a tab +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 + +-- Grayson - Auto indent settings +vim.opt.expandtab = false +vim.opt.smarttab = true +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.cindent = true + +-- Escape insert mode *and* dismiss Copilot suggestions +vim.keymap.set('i', '', function() + local ok, suggestion = pcall(require, 'copilot.suggestion') + if ok and suggestion and suggestion.is_visible() then + suggestion.dismiss() + end + return '' +end, { expr = true, silent = true }) + -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) -- See `:help 'confirm'` @@ -247,6 +292,61 @@ require('lazy').setup({ -- -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- + -- Colorizer + { + 'norcalli/nvim-colorizer.lua', + config = function() + require('colorizer').setup({ + '*', -- Highlight all filetypes + css = { rgb_fn = true }, + html = { names = true }, + }, { + mode = 'background', + }) + end, + }, + + -- GitHub Copilot + { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + config = function() + require('copilot').setup { + suggestion = { + enabled = true, + auto_trigger = true, + debounce = 75, + keymap = { + accept = '', + next = '', + prev = '', + dismiss = '', + }, + }, + panel = { + enabled = true, + auto_refresh = false, + keymap = { + jump_prev = '[[', + jump_next = ']]', + accept = '', + refresh = 'gr', + open = '', + }, + }, + filetypes = { + markdown = true, + help = false, + gitcommit = true, + gitrebase = true, + ['*'] = true, -- enable for all filetypes + }, + copilot_node_command = 'node', -- Ensure correct Node.js path + server_opts_overrides = {}, + } + end, + }, -- Alternatively, use `config = function() ... end` for full control over the configuration. -- If you prefer to call `setup` explicitly, use: @@ -434,6 +534,9 @@ require('lazy').setup({ vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + -- Open file explorer + vim.keymap.set('n', 'e', ':Ex', { desc = '[E]xplorer' }) + -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. @@ -472,6 +575,7 @@ require('lazy').setup({ }, }, }, + { -- Main LSP Configuration 'neovim/nvim-lspconfig', @@ -668,10 +772,50 @@ require('lazy').setup({ -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local function on_attach(client, bufnr) + if client.name == 'sqls' then + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + end + end + local servers = { -- clangd = {}, - -- gopls = {}, - -- pyright = {}, + gopls = {}, + pyright = {}, + jsonls = { + settings = { + json = { + validate = { enable = true }, + }, + }, + }, + sqls = { + on_attach = on_attach, + settings = { + sqls = { + connections = { + { + driver = 'postgres', + dataSourceName = 'postgres:postgres@localhost:5432/gator', + schemaSearchPath = { 'public' }, + }, + }, + }, + }, + }, + clangd = {}, + html = {}, + cssls = {}, + ts_ls = { + filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' }, + }, + jdtls = {}, + eslint = { + settings = { + format = { enable = true }, + }, + }, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -961,7 +1105,7 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'java' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { diff --git a/lua/autopairs-config.lua b/lua/autopairs-config.lua new file mode 100644 index 00000000000..88ed5115720 --- /dev/null +++ b/lua/autopairs-config.lua @@ -0,0 +1,35 @@ +-- autopairs-config.lua + +-- Setup autopairs with nvim-cmp. +local status_ok, npairs = pcall(require, 'nvim-autopairs') +if not status_ok then + return +end + +npairs.setup { + check_ts = true, + ts_config = { + lua = { 'string', 'source' }, + javascript = { 'string', 'template_string' }, + java = false, + }, + disable_filetype = { 'TelescopePrompt', 'spectre_panel' }, + fast_wrap = { + map = '', + chars = { '{', '[', '(', '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''), + offset = 0, -- Offset from pattern match + end_key = '$', + keys = 'qwertyuiopzxcvbnmasdfghjkl', + check_comma = true, + highlight = 'PmenuSel', + highlight_grey = 'LineNr', + }, +} + +local cmp_autopairs = require 'nvim-autopairs.completion.cmp' +local cmp_status_ok, cmp = pcall(require, 'cmp') +if not cmp_status_ok then + return +end +cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done { map_char = { tex = '' } }) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..86f2d5cf716 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,21 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +print 'plugins.lua is being loaded' + +return { + + -- Colorizer + { + 'norcalli/nvim-colorizer.lua', + config = function() + require('colorizer').setup({ + '*', -- Highlight all filetypes + css = { rgb_fn = true }, + html = { names = false }, + }, { + mode = 'foreground', + }) + end, + }, +} diff --git a/lua/kickstart/plugins/copilot.lua b/lua/kickstart/plugins/copilot.lua new file mode 100644 index 00000000000..cbbf4b7b3f0 --- /dev/null +++ b/lua/kickstart/plugins/copilot.lua @@ -0,0 +1,5 @@ +-- lua/kickstart/plugins/copilot-vim.lua +return { + 'github/copilot.vim', + event = 'InsertEnter', -- Lazy-load on insert +} diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 00000000000..1b8cb8dfbf4 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,106 @@ +return { + + -- Alpha (Dashboard) + { + 'goolord/alpha-nvim', + lazy = true, + }, + + -- Auto Pairs + -- Added This Plugin + { + 'windwp/nvim-autopairs', + }, + + -- Bufferline + { + 'akinsho/bufferline.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + }, + + -- Colorscheme + { + 'folke/tokyonight.nvim', + }, + + -- Hop (Better Navigation) + { + 'phaazon/hop.nvim', + lazy = true, + }, + + -- Lualine + { + 'nvim-lualine/lualine.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + }, + + -- Language Support + { + 'VonHeikemen/lsp-zero.nvim', + lazy = true, + branch = 'v1.x', + dependencies = { + -- LSP Support + { 'neovim/nvim-lspconfig' }, -- Required + { 'williamboman/mason.nvim' }, -- Optional + { 'williamboman/mason-lspconfig.nvim' }, -- Optional + + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, -- Required + { 'hrsh7th/cmp-nvim-lsp' }, -- Required + { 'hrsh7th/cmp-buffer' }, -- Optional + { 'hrsh7th/cmp-path' }, -- Optional + { 'saadparwaiz1/cmp_luasnip' }, -- Optional + { 'hrsh7th/cmp-nvim-lua' }, -- Optional + + -- Snippets + { 'L3MON4D3/LuaSnip' }, -- Required + { 'rafamadriz/friendly-snippets' }, -- Optional + }, + }, + + -- Nvimtree (File Explorer) + { + 'nvim-tree/nvim-tree.lua', + lazy = true, + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + }, + + -- Telescope (Fuzzy Finder) + { + 'nvim-telescope/telescope.nvim', + lazy = true, + dependencies = { + { 'nvim-lua/plenary.nvim' }, + }, + }, + + -- Treesitter + { + 'nvim-treesitter/nvim-treesitter', + }, + + -- Toggle Term + { + 'akinsho/toggleterm.nvim', + config = true, + }, + + -- Which-key + { + 'folke/which-key.nvim', + lazy = true, + }, + -- Github Copilot + { + 'github/copilot.vim', + event = 'InsertEnter', + }, +} diff --git a/pack/github/start/copilot.vim b/pack/github/start/copilot.vim new file mode 160000 index 00000000000..51f80c0ed4f --- /dev/null +++ b/pack/github/start/copilot.vim @@ -0,0 +1 @@ +Subproject commit 51f80c0ed4f70d1c7e8c0ff11a792a9d84502c03 From 8579d42c7e6d03ea572be1802840be7c0069820e Mon Sep 17 00:00:00 2001 From: Grayson Butcher Date: Wed, 24 Sep 2025 11:25:38 -0600 Subject: [PATCH 2/2] 09/24/2025 --- README.md | 3 +- init.lua | 283 +++++++++++++--------------- lua/kickstart/plugins/autopairs.lua | 10 +- lua/kickstart/plugins/debug.lua | 2 +- lua/kickstart/plugins/lint.lua | 2 +- lua/kickstart/plugins/neo-tree.lua | 2 +- 6 files changed, 141 insertions(+), 161 deletions(-) diff --git a/README.md b/README.md index 8ace8b9b22b..4113950550d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ If you are experiencing issues, please make sure you have the latest versions. External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), + [fd-find](https://github.com/sharkdp/fd#installation) - Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true diff --git a/init.lua b/init.lua index c9cd20d4775..775d04b0cf0 100644 --- a/init.lua +++ b/init.lua @@ -93,67 +93,76 @@ vim.g.maplocalleader = ' ' vim.g.have_nerd_font = false -- [[ Setting options ]] --- See `:help vim.opt` +-- See `:help vim.o` -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` -- Make line numbers default -vim.opt.number = true +vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! +<<<<<<< HEAD vim.opt.relativenumber = true +======= +-- vim.o.relativenumber = true +>>>>>>> 3338d3920620861f8313a2745fd5d2be39f39534 -- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = 'a' +vim.o.mouse = 'a' -- Don't show the mode, since it's already in the status line -vim.opt.showmode = false +vim.o.showmode = false -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' + vim.o.clipboard = 'unnamedplus' end) -- Enable break indent -vim.opt.breakindent = true +vim.o.breakindent = true -- Save undo history -vim.opt.undofile = true +vim.o.undofile = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true +vim.o.ignorecase = true +vim.o.smartcase = true -- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' +vim.o.signcolumn = 'yes' -- Decrease update time -vim.opt.updatetime = 250 +vim.o.updatetime = 250 -- Decrease mapped sequence wait time -vim.opt.timeoutlen = 300 +vim.o.timeoutlen = 300 -- Configure how new splits should be opened -vim.opt.splitright = true -vim.opt.splitbelow = true +vim.o.splitright = true +vim.o.splitbelow = true -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` -vim.opt.list = true +-- +-- Notice listchars is set using `vim.opt` instead of `vim.o`. +-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. +-- See `:help lua-options` +-- and `:help lua-options-guide` +vim.o.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! -vim.opt.inccommand = 'split' +vim.o.inccommand = 'split' -- Show which line your cursor is on -vim.opt.cursorline = true +vim.o.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 +vim.o.scrolloff = 10 local mode_disabled = false local filetype_disabled = false @@ -204,7 +213,7 @@ end, { expr = true, silent = true }) -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) -- See `:help 'confirm'` -vim.opt.confirm = true +vim.o.confirm = true -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -239,7 +248,7 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) --- NOTE: Some terminals have coliding keymaps or are not able to send distinct keycodes +-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes -- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) -- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) @@ -250,12 +259,12 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` +-- See `:help vim.hl.on_yank()` vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() - vim.highlight.on_yank() + vim.hl.on_yank() end, }) @@ -268,8 +277,11 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end -end ---@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) +end + +---@type vim.Option +local rtp = vim.opt.rtp +rtp:prepend(lazypath) -- [[ Configure and install plugins ]] -- @@ -284,7 +296,7 @@ vim.opt.rtp:prepend(lazypath) -- NOTE: Here is where you install your plugins. require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following @@ -395,7 +407,7 @@ require('lazy').setup({ event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { -- delay between pressing a key and opening which-key (milliseconds) - -- this setting is independent of vim.opt.timeoutlen + -- this setting is independent of vim.o.timeoutlen delay = 0, icons = { -- set icon mappings to true if you have a Nerd Font @@ -436,11 +448,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, @@ -457,7 +465,6 @@ require('lazy').setup({ { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', event = 'VimEnter', - branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions @@ -583,15 +590,15 @@ require('lazy').setup({ -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'williamboman/mason.nvim', opts = {} }, - 'williamboman/mason-lspconfig.nvim', + { 'mason-org/mason.nvim', opts = {} }, + 'mason-org/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. { 'j-hui/fidget.nvim', opts = {} }, - -- Allows extra capabilities provided by nvim-cmp - 'hrsh7th/cmp-nvim-lsp', + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', }, config = function() -- Brief aside: **What is LSP?** @@ -636,42 +643,42 @@ require('lazy').setup({ vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. - map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - -- 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('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('grd', 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('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) - - -- 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') + -- 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('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) ---@param client vim.lsp.Client @@ -758,10 +765,9 @@ require('lazy').setup({ -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. @@ -920,12 +926,14 @@ require('lazy').setup({ }, { -- Autocompletion - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', + 'saghen/blink.cmp', + event = 'VimEnter', + version = '1.*', dependencies = { - -- Snippet Engine & its associated nvim-cmp source + -- Snippet Engine { 'L3MON4D3/LuaSnip', + version = '2.*', build = (function() -- Build Step is needed for regex support in snippets. -- This step is not supported in many windows environments. @@ -946,95 +954,74 @@ require('lazy').setup({ -- end, -- }, }, + opts = {}, }, - 'saadparwaiz1/cmp_luasnip', - - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-nvim-lsp-signature-help', + 'folke/lazydev.nvim', }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + -- 'default' (recommended) for mappings similar to built-in completions + -- to accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- 'super-tab' for tab to accept + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- For an understanding of why the 'default' preset is recommended, + -- you will need to read `:help ins-completion` -- -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, - - -- If you prefer more traditional completion keymaps, - -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), - - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), + -- + -- All presets have the following mappings: + -- /: move to right/left of your snippet expansion + -- : Open menu or open docs if already open + -- / or /: Select next/previous item + -- : Hide menu + -- : Toggle signature help + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + preset = 'default', - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { - name = 'lazydev', - -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it - group_index = 0, - }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - { name = 'nvim_lsp_signature_help' }, + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + }, + + completion = { + -- By default, you may press `` to show the documentation. + -- Optionally, set `auto_show = true` to show the documentation after a delay. + documentation = { auto_show = false, auto_show_delay_ms = 500 }, + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, - } - end, + }, + + snippets = { preset = 'luasnip' }, + + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + -- + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + -- + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = 'lua' }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, }, { -- You can easily change to a different colorscheme. diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 87a7e5ffa2e..386d392e7ad 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -4,13 +4,5 @@ return { 'windwp/nvim-autopairs', event = 'InsertEnter', - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require('nvim-autopairs').setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - local cmp = require 'cmp' - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) - end, + opts = {}, } diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 753cb0cedd3..8e332bf2ff9 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -18,7 +18,7 @@ return { 'nvim-neotest/nvim-nio', -- Installs the debug adapters for you - 'williamboman/mason.nvim', + 'mason-org/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', -- Add your own debuggers here diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 907c6bf3e31..dec42f097c6 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -50,7 +50,7 @@ return { -- Only run the linter in buffers that you can modify in order to -- avoid superfluous noise, notably within the handy LSP pop-ups that -- describe the hovered symbol using Markdown. - if vim.opt_local.modifiable:get() then + if vim.bo.modifiable then lint.try_lint() end end, diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index bd4422695aa..c7067891df0 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -9,7 +9,7 @@ return { 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'MunifTanjim/nui.nvim', }, - cmd = 'Neotree', + lazy = false, keys = { { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, },