config: nvim: rewrite config in lua and use packer as plugin manager
This commit is contained in:
parent
07be5a4e7a
commit
6863d4c2eb
11 changed files with 174 additions and 197 deletions
61
config/nvim/lua/plugins.lua
Normal file
61
config/nvim/lua/plugins.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
--------------------
|
||||
-- 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
|
||||
'romainl/vim-dichromatic',
|
||||
config = function() vim.cmd('colorscheme dichromatic') end,
|
||||
}
|
||||
use { -- color highlighter
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function() require('colorizer').setup() end,
|
||||
}
|
||||
|
||||
-- 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
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue