From 96115787282ece7843fc7a5c7a787db57e14569b Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sat, 8 Jul 2023 21:51:11 +0200 Subject: [PATCH] vim: replace packer.nvim with lazy.nvim --- config/nvim/lua/user/init.lua | 16 +++++- config/nvim/lua/user/plugins.lua | 78 --------------------------- config/nvim/lua/user/plugins/init.lua | 50 +++++++++++++++++ 3 files changed, 65 insertions(+), 79 deletions(-) delete mode 100644 config/nvim/lua/user/plugins.lua create mode 100644 config/nvim/lua/user/plugins/init.lua diff --git a/config/nvim/lua/user/init.lua b/config/nvim/lua/user/init.lua index 1ff6b8c..31903ca 100644 --- a/config/nvim/lua/user/init.lua +++ b/config/nvim/lua/user/init.lua @@ -3,8 +3,22 @@ vim.g.mapleader = ' ' require 'user.disable_builtin' require 'user.globals' require 'user.options' -require 'user.plugins' require 'user.keymaps' require 'user.autocmds' require 'user.filetypes' +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) + +require('lazy').setup 'user.plugins' + diff --git a/config/nvim/lua/user/plugins.lua b/config/nvim/lua/user/plugins.lua deleted file mode 100644 index d71faab..0000000 --- a/config/nvim/lua/user/plugins.lua +++ /dev/null @@ -1,78 +0,0 @@ -vim.g.better_whitespace_filetypes_blacklist = { - 'diff', - 'fugitive', - 'git', - 'gitcommit', - 'help', -} - -vim.g.VM_leader = '\\' -vim.g.VM_silent_exit = 1 - -local bootstrap_packer = function() - local path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' - - if vim.fn.empty(vim.fn.glob(path)) == 0 then - return false -- packer already installed, nothing else to do. - end - - local url = 'https://github.com/wbthomason/packer.nvim' - vim.notify(string.format('Packer not installed -> cloning from %s', url)) - local stdout = vim.fn.system({'git', 'clone', '--depth', '1', url, path}) - local error_code = vim.v.shell_error - - if error_code == 0 then - vim.cmd [[packadd packer.nvim]] - else - vim.notify(string.format('ERROR: clone failed with code %d', error_code)) - vim.notify(stdout, vim.log.levels.ERR) - end - - return true -end - -local packer_did_bootstrap = bootstrap_packer() -local ok, packer = pcall(require, 'packer') -if not ok or not packer then return end - -packer.startup(function(use) - use 'wbthomason/packer.nvim' - use 'nvim-lua/plenary.nvim' - - -- Visuals ---------------------------------------------------------------- - use '~/.dotfiles/plugins/solarized.nvim' - use 'kyazdani42/nvim-web-devicons' - use 'nvim-lualine/lualine.nvim' - use 'lukas-reineke/virt-column.nvim' - use 'lukas-reineke/indent-blankline.nvim' - use 'norcalli/nvim-colorizer.lua' - - -- Navigation ------------------------------------------------------------- - use 'nvim-telescope/telescope.nvim' - use 'nvim-telescope/telescope-file-browser.nvim' - use 'kyazdani42/nvim-tree.lua' - - -- Editing ---------------------------------------------------------------- - use 'ntpeters/vim-better-whitespace' - use 'godlygeek/tabular' - use 'tpope/vim-commentary' - -- use 'mg979/vim-visual-multi' - - -- git -------------------------------------------------------------------- - use 'tpope/vim-fugitive' - - -- Treesitter ------------------------------------------------------------- - use 'nvim-treesitter/nvim-treesitter' - use 'nvim-treesitter/nvim-treesitter-refactor' - use 'nvim-treesitter/nvim-treesitter-textobjects' - use 'nvim-treesitter/playground' - - -- Filetypes -------------------------------------------------------------- - use 'keith/swift.vim' - use 'chr4/nginx.vim' - - -- Misc ------------------------------------------------------------------- - use 'milisims/nvim-luaref' - - if packer_did_bootstrap then require('packer').sync() end -end) diff --git a/config/nvim/lua/user/plugins/init.lua b/config/nvim/lua/user/plugins/init.lua new file mode 100644 index 0000000..e34342b --- /dev/null +++ b/config/nvim/lua/user/plugins/init.lua @@ -0,0 +1,50 @@ +-- vim.g.better_whitespace_filetypes_blacklist = { +-- 'diff', +-- 'fugitive', +-- 'git', +-- 'gitcommit', +-- 'help', +-- } + +-- vim.g.VM_leader = '\\' +-- vim.g.VM_silent_exit = 1 + +return { + 'wbthomason/packer.nvim', + 'nvim-lua/plenary.nvim', + + -- Visuals ---------------------------------------------------------------- + { dir = '~/.dotfiles/plugins/solarized.nvim' }, + 'kyazdani42/nvim-web-devicons', + 'nvim-lualine/lualine.nvim', + 'lukas-reineke/virt-column.nvim', + 'lukas-reineke/indent-blankline.nvim', + 'norcalli/nvim-colorizer.lua', + + -- Navigation ------------------------------------------------------------- + 'nvim-telescope/telescope.nvim', + 'nvim-telescope/telescope-file-browser.nvim', + 'kyazdani42/nvim-tree.lua', + + -- Editing ---------------------------------------------------------------- + 'ntpeters/vim-better-whitespace', + 'godlygeek/tabular', + 'tpope/vim-commentary', + -- 'mg979/vim-visual-multi', + + -- git -------------------------------------------------------------------- + 'tpope/vim-fugitive', + + -- Treesitter ------------------------------------------------------------- + 'nvim-treesitter/nvim-treesitter', + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/playground', + + -- Filetypes -------------------------------------------------------------- + 'keith/swift.vim', + 'chr4/nginx.vim', + + -- Misc ------------------------------------------------------------------- + 'milisims/nvim-luaref', +}