Migrate from packer.nvim to lazy.nvim

This commit is contained in:
Emil Miler 2023-01-25 15:11:51 +01:00
parent f1e6f08360
commit 68615dada0
7 changed files with 123 additions and 99 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
plugin/packer_compiled.lua lazy-lock.json

View File

@ -1,4 +1,20 @@
require("config") local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
require("plugins") if not vim.loop.fs_stat(lazypath) then
require("completion") vim.fn.system({
require("callbacks") "git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
require('lazy').setup('plugins')
require('config')
require('completion')
require('callbacks')

View File

@ -1,94 +0,0 @@
return require('packer').startup(function()
-- automatic rebuild on plugins.lua change
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
use 'wbthomason/packer.nvim'
use 'RRethy/nvim-base16'
use 'tpope/vim-commentary'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
config = function()
local git_blame = require('gitblame')
require('lualine').setup({
sections = {
lualine_c = {
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }
}
}
})
vim.o.showmode = false
end
}
use {
'junegunn/goyo.vim',
config = function()
vim.keymap.set('n', '<leader>f', ':lua goyo_toggle()<cr>:Goyo<cr>')
end
}
-- Git
use {
'f-person/git-blame.nvim',
config = function()
vim.g.gitblame_date_format = '%r'
vim.g.gitblame_message_when_not_committed = ''
vim.g.gitblame_display_virtual_text = 0
end
}
use {
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
end
}
-- completion
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'saadparwaiz1/cmp_luasnip'
-- snippets
use 'L3MON4D3/LuaSnip'
use 'rafamadriz/friendly-snippets'
-- emmet
use 'mattn/emmet-vim'
-- LSP
use 'neovim/nvim-lspconfig'
-- LSP, DAP, linters and formatters
-- use 'jose-elias-alvarez/null-ls.nvim'
use {
'dense-analysis/ale',
config = function()
vim.cmd [[ g:ale_sign_column_always = 1 ]]
end
}
-- management for LSP, DAP, linters and formatters
use {
'williamboman/mason.nvim',
config = function()
require('mason').setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
})
end
}
use 'williamboman/mason-lspconfig.nvim'
end)

16
lua/plugins/git.lua Normal file
View File

@ -0,0 +1,16 @@
return {
{
'f-person/git-blame.nvim',
config = function()
vim.g.gitblame_date_format = '%r'
vim.g.gitblame_message_when_not_committed = ''
vim.g.gitblame_display_virtual_text = 0
end
},
{
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
end
},
}

53
lua/plugins/init.lua Normal file
View File

@ -0,0 +1,53 @@
return {
'RRethy/nvim-base16',
'tpope/vim-commentary',
{
'junegunn/goyo.vim',
config = function()
vim.keymap.set('n', '<leader>f', ':lua goyo_toggle()<cr>:Goyo<cr>')
end
},
-- completion
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'saadparwaiz1/cmp_luasnip',
-- snippets
'L3MON4D3/LuaSnip',
'rafamadriz/friendly-snippets',
-- emmet
'mattn/emmet-vim',
-- LSP
'neovim/nvim-lspconfig',
-- LSP, DAP, linters and formatters
-- 'jose-elias-alvarez/null-ls.nvim',
{
'dense-analysis/ale',
config = function()
vim.cmd [[ g:ale_sign_column_always = 1 ]]
end
},
-- management for LSP, DAP, linters and formatters
{
'williamboman/mason.nvim',
config = function()
require('mason').setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
})
end
},
'williamboman/mason-lspconfig.nvim',
}

15
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,15 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true },
config = function()
local git_blame = require('gitblame')
require('lualine').setup({
sections = {
lualine_c = {
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }
}
}
})
vim.o.showmode = false
end
}

18
lua/plugins/neo-tree.lua Normal file
View File

@ -0,0 +1,18 @@
return {
'nvim-neo-tree/neo-tree.nvim',
cmd = 'Neotree',
branch = 'v2.x',
keys = {
{ '<leader>ft', '<cmd>Neotree toggle<cr>', desc = 'NeoTree' },
},
dependencies = {
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
},
config = {
filesystem = {
follow_current_file = true,
hijack_netrw_behavior = 'open_current',
},
},
}