Having packer install auto
This commit is contained in:
16
init.lua
16
init.lua
@@ -17,6 +17,18 @@ vim.opt.cursorline = true
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = { "org" }, command = "setlocal nowrap" })
|
||||
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
use 'tpope/vim-surround'
|
||||
@@ -248,6 +260,10 @@ require('packer').startup(function(use)
|
||||
require("trouble").setup()
|
||||
end
|
||||
}
|
||||
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
Reference in New Issue
Block a user