Change nvim package manager from packer to lazy.nvim

This commit is contained in:
James Dixon 2024-12-22 14:32:32 -05:00
parent 3c5ce1e1bc
commit 3450bdd4e4
8 changed files with 107 additions and 84 deletions

View File

@ -3,7 +3,7 @@
-- general vim settings -- general vim settings
require('config.settings') -- general vim settings require('config.settings') -- general vim settings
require('config.keymaps') -- general vim keymaps require('config.keymaps') -- general vim keymaps
require('config.plugins') -- loads plugins (packer) require('config.lazy') -- nvim plugins
require('config.platform_specific') -- platform specific settings (Win32, Mac, Linux) require('config.platform_specific') -- platform specific settings (Win32, Mac, Linux)
-- plugin configurations -- plugin configurations

View File

@ -0,0 +1,30 @@
{
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"fidget.nvim": { "branch": "main", "commit": "9238947645ce17d96f30842e61ba81147185b657" },
"fzf": { "branch": "master", "commit": "97030d4cb10d9b1c51f2afd60e14c6e46a7fe4ba" },
"fzf.vim": { "branch": "master", "commit": "556f45e79ae5e3970054fee4c4373472604a1b4e" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neovim": { "branch": "main", "commit": "91548dca53b36dbb9d36c10f114385f759731be1" },
"neovim-ayu": { "branch": "master", "commit": "37160699469d695486174fb863aae2f2a4c1f90f" },
"nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
"nvim-lspconfig": { "branch": "master", "commit": "9204642002ba91f9e0b7d0e5989f373657fe754a" },
"nvim-treesitter": { "branch": "master", "commit": "caba7ef3556079dec03407bcbb290ddc688ea06e" },
"tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-eunuch": { "branch": "master", "commit": "c61533c9868ce78bb7fcbe06b308d7fa7f19e447" },
"vim-fugitive": { "branch": "master", "commit": "fcb4db52e7f65b95705aa58f0f2df1312c1f2df2" },
"vim-hybrid": { "branch": "master", "commit": "cc58baabeabc7b83768e25b852bf89c34756bf90" },
"vim-nightfly-colors": { "branch": "master", "commit": "f1176605eb01b38d84e0e9e221c9599bd022dfd4" },
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-rsi": { "branch": "master", "commit": "45540637ead22f011e8215f1c90142e49d946a54" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" }
}

View File

@ -0,0 +1,70 @@
-- 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)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{
-- * vanilla vim plugins * --
-- normal mode keybinds
'tpope/vim-commentary',
'tpope/vim-surround',
'tpope/vim-unimpaired',
-- command mode keybinds
'tpope/vim-rsi',
'tpope/vim-eunuch',
'tpope/vim-repeat',
'tpope/vim-unimpaired',
-- git
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
'lewis6991/gitsigns.nvim',
-- fzf
'junegunn/fzf', run = ":call fzf#install()",
'junegunn/fzf.vim',
-- lsp
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
"L3MON4D3/LuaSnip",
'hrsh7th/nvim-cmp',
'nvim-treesitter/nvim-treesitter',
"j-hui/fidget.nvim",
-- colorschemes
'rose-pine/neovim',
'w0ng/vim-hybrid',
'folke/tokyonight.nvim',
'bluz71/vim-nightfly-colors',
'Shatur/neovim-ayu'
},
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View File

@ -1,75 +0,0 @@
-- plugins.lua
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
vim.cmd('packadd packer.nvim')
end
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
-- * nvim specific plugins * --
use { -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
requires = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'j-hui/fidget.nvim',
},
}
use { -- Autocompletion (cmp)
'hrsh7th/nvim-cmp',
requires = {
'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip'
},
}
use { -- Highlighting/nav/editing (TreeSitter)
'nvim-treesitter/nvim-treesitter',
run = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
end,
}
use { -- File Explorer
'nvim-tree/nvim-tree.lua',
requires = {
'nvim-tree/nvim-web-devicons', -- optional, for file icons
},
tag = 'nightly'
}
-- * vanilla vim plugins * --
-- normal mode keybinds
use 'tpope/vim-commentary'
use 'tpope/vim-surround'
use 'tpope/vim-unimpaired'
-- command mode keybinds
use 'tpope/vim-rsi'
use 'tpope/vim-eunuch'
use 'tpope/vim-repeat'
-- git
use 'tpope/vim-fugitive'
use 'tpope/vim-rhubarb'
-- use 'airblade/vim-gitgutter'
use { 'lewis6991/gitsigns.nvim' }
-- fzf
use { 'junegunn/fzf', run = ":call fzf#install()" }
use { 'junegunn/fzf.vim' }
-- colorschemes
-- use 'rose-pine/neovim'
use 'w0ng/vim-hybrid'
use 'folke/tokyonight.nvim'
use 'bluz71/vim-nightfly-colors'
use 'Shatur/neovim-ayu'
end)

View File

@ -35,15 +35,12 @@ local on_attach = function(_, bufnr)
vim.lsp.buf.formatting() vim.lsp.buf.formatting()
end end
end, { desc = 'Format current buffer with LSP' }) end, { desc = 'Format current buffer with LSP' })
end end
-- mason - package manager for lsp servers -- mason - package manager for lsp servers
require('mason').setup() require('mason').setup()
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'gopls', 'bashls' } local servers = { 'clangd', 'rust_analyzer', 'pylsp', 'ts_ls', 'lua_ls', 'gopls', 'bashls' }
require('mason-lspconfig').setup { require('mason-lspconfig').setup({ ensure_installed = servers })
ensure_installed = servers,
}
-- nvim-cmp - extend capabilities -- nvim-cmp - extend capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
@ -60,7 +57,6 @@ end
-- fidget - for lsp status above statusline -- fidget - for lsp status above statusline
require('fidget').setup() require('fidget').setup()
-- lua lsp config -- lua lsp config
-- Make runtime files discoverable to the server -- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';') local runtime_path = vim.split(package.path, ';')

View File

@ -1,3 +1,3 @@
-- NvimTree -- NvimTree
require('nvim-tree').setup() -- require('nvim-tree').setup()
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<cr>') -- vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<cr>')

View File

@ -1,6 +1,7 @@
-- [[ Configure Treesitter ]] -- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter` -- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
ignore_install = { 'help' },
-- Add languages to be installed here that you want installed for treesitter -- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' }, ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' },

View File

@ -80,6 +80,7 @@ alias g="git"
alias groot="cd $(git rev-parse --show-toplevel 2>/dev/null || echo -n ".")" alias groot="cd $(git rev-parse --show-toplevel 2>/dev/null || echo -n ".")"
alias v="$EDITOR" alias v="$EDITOR"
alias vi="$EDITOR" alias vi="$EDITOR"
alias nv="nvim"
alias tmls="tmux ls" alias tmls="tmux ls"
alias tmlsc="tmux lsc" alias tmlsc="tmux lsc"
alias tmks="tmux kill-session -t" # kill one session alias tmks="tmux kill-session -t" # kill one session