-------------------- -- Packer Bootstrap -------------------- local packer_installed, _ = pcall(require, 'packer') local packer_bootstrap = false if (not packer_installed) then -- ask user whether packer should be bootstrapped packer_bootstrap = require('utils').prompt( 'Plugin manager packer not found. Install it now?', 'Bootstrapping packer now...', 'Skipping setup of packer and plugins.') if (not packer_bootstrap) then return end -- perform actual bootstrap local fn = vim.fn local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) vim.cmd('packadd packer.nvim') end -- helper function to be used `config` parameter of packer's use to externalize -- plugin configuration, expects the name of the config file function load_config(name) return string.format('require("plugins/%s")', name) end return require('packer').startup({ function(use) use 'wbthomason/packer.nvim' -------------------- -- Visuals -------------------- use { -- colorblind-friendly colorscheme 'projekt0n/github-nvim-theme', config = load_config('github-nvim-theme'), } use { -- color highlighter 'norcalli/nvim-colorizer.lua', config = function() require('colorizer').setup() end, } -------------------- -- Package Manager -------------------- use { -- portable package manager 'williamboman/mason.nvim', config = load_config('mason'), } use { -- update helper for mason 'WhoIsSethDaniel/mason-tool-installer.nvim', after = { 'mason.nvim' }, config = function() require('mason-tool-installer').setup({}) end, } -------------------- -- LSP Setup -------------------- use { -- compatibility layer between mason and lspconfig + autoinstaller 'williamboman/mason-lspconfig.nvim', after = { 'mason.nvim' }, requires = { 'neovim/nvim-lspconfig', }, } use { -- configuration layer for neovim LSP client 'neovim/nvim-lspconfig', after = { 'mason-lspconfig.nvim', 'cmp-nvim-lsp', }, config = load_config('lspconfig'), } -------------------- -- Snippets -------------------- use { -- snippet engine 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip', 'rafamadriz/friendly-snippets', }, } use { -- various snippets 'rafamadriz/friendly-snippets', after = { 'LuaSnip' }, config = load_config('friendly-snippets'), } -------------------- -- Completion -------------------- use { -- nvim-cmp source for nvim-lsp 'hrsh7th/cmp-nvim-lsp', requires = { 'hrsh7th/nvim-cmp' }, } use { -- nvim-cmp source for LuaSnip 'saadparwaiz1/cmp_luasnip', requires = { 'hrsh7th/nvim-cmp' }, after = { 'LuaSnip' }, } use { -- nvim-cmp source for buffer words 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/nvim-cmp' }, } use { -- nvim-cmp source for filesystem paths 'hrsh7th/cmp-path', requires = { 'hrsh7th/nvim-cmp' }, } use { -- nvim-cmp source for vim's cmdline 'hrsh7th/cmp-cmdline', requires = { 'hrsh7th/nvim-cmp' }, } use { -- completion engine 'hrsh7th/nvim-cmp', after = { 'cmp-nvim-lsp', 'cmp-buffer', 'cmp-path', 'cmp-cmdline', 'cmp_luasnip' }, config = load_config('nvim-cmp'), } -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if packer_bootstrap then require('packer').sync() end end, config = { display = { open_fn = require("packer.util").float, }, profile = { enable = true, threshold = 1, -- the amount in ms that a plugins load time must be over for it to be included in the profile }, }, })