Configure nvim with Lazy and pulling from .vimrc

Add plugins for LSP, monokai-pro, and love2d
This commit is contained in:
Sage Vaillancourt 2025-03-11 13:57:31 -04:00
parent 9015815872
commit c23bf1d931
6 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,10 @@
so ~/.vimrc
lua <<EOF
require("config.lazy")
require'lspconfig'.lua_ls.setup{}
EOF
colorscheme monokai-pro

View File

@ -0,0 +1,10 @@
{
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"love2d.nvim": { "branch": "main", "commit": "d2612df4aa1325f81abc05fb6f8596f279587ad5" },
"monokai-pro.nvim": { "branch": "master", "commit": "872f774303f79416000e8049630052f4124d9534" },
"nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" },
"nvim-lspconfig": { "branch": "master", "commit": "8a1529e46eef5efc86c34c8d9bdd313abc2ecba0" }
}

View File

@ -0,0 +1,97 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "monokai-pro" } },
-- automatically check for plugin updates
checker = { enabled = true },
})
-------------------------------
-- BS TO SET UP AUTOCOMPLETE --
-------------------------------
-- Add additional capabilities supported by nvim-cmp
-- local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- local lspconfig = require('lspconfig')
-- -- Enable some language servers with the additional completion capabilities offered by nvim-cmp
-- local servers = { 'lua_ls' }
-- for _, lsp in ipairs(servers) do
-- lspconfig[lsp].setup {
-- -- on_attach = my_custom_on_attach,
-- capabilities = capabilities,
-- }
-- end
-- luasnip setup
local luasnip = require 'luasnip'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}

View File

@ -0,0 +1,10 @@
return {
"S1M0N38/love2d.nvim",
cmd = "LoveRun",
opts = { },
keys = {
{ "<leader>v", ft = "lua", desc = "LÖVE" },
{ "<leader>vv", "<cmd>LoveRun<cr>", ft = "lua", desc = "Run LÖVE" },
{ "<leader>vs", "<cmd>LoveStop<cr>", ft = "lua", desc = "Stop LÖVE" },
},
}

View File

@ -0,0 +1,3 @@
return {
"loctvl842/monokai-pro.nvim",
}

View File

@ -0,0 +1,7 @@
return {
"hrsh7th/nvim-cmp", -- Autocompletion plugin,
"hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp,
"saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp
"L3MON4D3/LuaSnip", -- Snippets plugin
"neovim/nvim-lspconfig",
}