From 68615dada0390bd48530d634ee9feca3165a9299 Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Wed, 25 Jan 2023 15:11:51 +0100 Subject: [PATCH] Migrate from packer.nvim to lazy.nvim --- .gitignore | 2 +- init.lua | 24 ++++++++-- lua/plugins.lua | 94 ---------------------------------------- lua/plugins/git.lua | 16 +++++++ lua/plugins/init.lua | 53 ++++++++++++++++++++++ lua/plugins/lualine.lua | 15 +++++++ lua/plugins/neo-tree.lua | 18 ++++++++ 7 files changed, 123 insertions(+), 99 deletions(-) delete mode 100644 lua/plugins.lua create mode 100644 lua/plugins/git.lua create mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/lualine.lua create mode 100644 lua/plugins/neo-tree.lua diff --git a/.gitignore b/.gitignore index c84aa4a..e033bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -plugin/packer_compiled.lua +lazy-lock.json diff --git a/init.lua b/init.lua index df79b58..c24a685 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,20 @@ -require("config") -require("plugins") -require("completion") -require("callbacks") +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "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') diff --git a/lua/plugins.lua b/lua/plugins.lua deleted file mode 100644 index 075d634..0000000 --- a/lua/plugins.lua +++ /dev/null @@ -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 | 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', 'f', ':lua goyo_toggle():Goyo') - 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) diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..4516d6a --- /dev/null +++ b/lua/plugins/git.lua @@ -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 + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..02106ba --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,53 @@ +return { + 'RRethy/nvim-base16', + 'tpope/vim-commentary', + { + 'junegunn/goyo.vim', + config = function() + vim.keymap.set('n', 'f', ':lua goyo_toggle():Goyo') + 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', +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..b7590b7 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -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 +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..abf39fb --- /dev/null +++ b/lua/plugins/neo-tree.lua @@ -0,0 +1,18 @@ +return { + 'nvim-neo-tree/neo-tree.nvim', + cmd = 'Neotree', + branch = 'v2.x', + keys = { + { 'ft', 'Neotree toggle', desc = 'NeoTree' }, + }, + dependencies = { + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + }, + config = { + filesystem = { + follow_current_file = true, + hijack_netrw_behavior = 'open_current', + }, + }, +}