601 lines · 14.1 KB
vim.loader.enable()

local g = vim.g
local opt = vim.opt
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup
local hi = vim.api.nvim_set_hl

local map = vim.keymap.set
local nmap = function(lhs, rhs, opts)
	vim.keymap.set("n", lhs, rhs, opts)
end
local vmap = function(lhs, rhs, opts)
	vim.keymap.set("v", lhs, rhs, opts)
end

-- PackChanged hook for nvim-treesitter to run TSUpdate after update
vim.api.nvim_create_autocmd("PackChanged", {
	callback = function(ev)
		local name, kind = ev.data.spec.name, ev.data.kind
		if name == "nvim-treesitter" and kind == "update" then
			if not ev.data.active then
				vim.cmd.packadd("nvim-treesitter")
			end
			vim.cmd("TSUpdate")
		end
	end,
})

-- Plugins
local github = function(repo)
	return "https://github.com/" .. repo
end
vim.pack.add(vim.tbl_map(github, {
	"airblade/vim-gitgutter",
	"catgoose/nvim-colorizer.lua",
	"folke/trouble.nvim",
	"github/copilot.vim",
	"hrsh7th/vim-vsnip",
	"jamessan/vim-gnupg",