Aug5 main commit

This commit is contained in:
Matthew Schumaecker 2024-08-05 12:45:24 -04:00
parent 9ca19d45f7
commit f3926844bc
1 changed files with 19 additions and 60 deletions

View File

@ -12,24 +12,25 @@ if not vim.uv.fs_stat(lazypath) then
end ---@diagnostic disable-next-line: undefined-field end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
-- [[ Configure and install plugins ]]
-- --
-- To check the current status of your plugins, run
-- :Lazy
--
-- You can press `?` in this menu for help. Use `:q` to close the window
--
-- To update plugins you can run
--
-- :Lazy update
--
-- This the beginning of and enormous line of code require('lazy').setup({})
--
-- NOTE: Here is where you install your plugins.
require('lazy').setup({ require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
{
'tpope/vim-dadbod',
'kristijanhusak/vim-dadbod-completion',
'kristijanhusak/vim-dadbod-ui',
},
{ 'akinsho/toggleterm.nvim' },
{ 'echasnovski/mini.nvim', version = false }, { 'echasnovski/mini.nvim', version = false },
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = true,
-- use opts = {} for passing setup options
-- this is equalent to setup({}) function
},
-- NOTE: Plugins can also be added by using a table, -- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following -- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc. -- keys can be used to configure plugin behavior/loading/etc.
@ -88,7 +89,6 @@ require('lazy').setup({
} }
end, end,
}, },
{ 'akinsho/toggleterm.nvim' },
-- NOTE: Plugins can specify dependencies. -- NOTE: Plugins can specify dependencies.
-- --
-- The dependencies are proper plugin specifications as well - anything -- The dependencies are proper plugin specifications as well - anything
@ -104,13 +104,7 @@ require('lazy').setup({
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions { -- If encountering errors, see telescope-fzf-native README for installation instructions
'nvim-telescope/telescope-fzf-native.nvim', 'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = 'make', build = 'make',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function() cond = function()
return vim.fn.executable 'make' == 1 return vim.fn.executable 'make' == 1
end, end,
@ -232,50 +226,16 @@ require('lazy').setup({
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
}, },
config = function() config = function()
-- Brief aside: **What is LSP?**
--
-- LSP is an initialism you've probably heard, but might not understand what it is.
--
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
-- and language tooling communicate in a standardized fashion.
--
-- In general, you have a "server" which is some tool built to understand a particular
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
-- processes that communicate with some "client" - in this case, Neovim!
--
-- LSP provides Neovim with features like:
-- - Go to definition
-- - Find references
-- - Autocompletion
-- - Symbol Search
-- - and more!
--
-- Thus, Language Servers are external tools that must be installed separately from
-- Neovim. This is where `mason` and related plugins come into play.
--
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
-- and elegantly composed help section, `:help lsp-vs-treesitter`
-- This function gets run when an LSP attaches to a particular buffer.
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
-- function will be executed to configure the current buffer
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event) callback = function(event)
-- NOTE: Remember that Lua is a real programming language, and as such it is possible -- NOTE: Remember that Lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself. -- to define small helper and utility functions so you don't have to repeat yourself.
-- --
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc) local map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end 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 <C-t>.
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-- Find references for the word under your cursor. -- Find references for the word under your cursor.
@ -515,9 +475,9 @@ require('lazy').setup({
-- No, but seriously. Please read `:help ins-completion`, it is really good! -- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert {
-- Select the [n]ext item -- Select the [n]ext item
['<C-n>'] = cmp.mapping.select_next_item(), -- ['<C-n>'] = cmp.mapping.select_next_item(),
-- Select the [p]revious item -- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(), -- ['<C-p>'] = cmp.mapping.select_prev_item(),
-- Scroll the documentation window [b]ack / [f]orward -- Scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-b>'] = cmp.mapping.scroll_docs(-4),
@ -527,12 +487,11 @@ require('lazy').setup({
-- This will auto-import if your LSP supports it. -- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet. -- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true }, ['<C-y>'] = cmp.mapping.confirm { select = true },
-- If you prefer more traditional completion keymaps, -- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines -- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true }, ['<CR>'] = cmp.mapping.confirm { select = true },
--['<Tab>'] = cmp.mapping.select_next_item(), ['<Tab>'] = cmp.mapping.select_next_item(),
--['<S-Tab>'] = cmp.mapping.select_prev_item(), ['<S-Tab>'] = cmp.mapping.select_prev_item(),
-- Manually trigger a completion from nvim-cmp. -- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display -- Generally you don't need this, because nvim-cmp will display