DEVELOPMENT ENVIRONMENT

~alex/dotfiles

ref: a2c3a2b9c765e542e3a69c09ce04d22651729d26 dotfiles/nvim/lua/autocmds.lua -rw-r--r-- 904 bytes
a2c3a2b9 — Alejandro Laguna feat: init dotfiles 16 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
vim.api.nvim_create_autocmd("TextYankPost", {
	desc = "Highlight when yanking (copying) text",
	group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
	callback = function()
		vim.highlight.on_yank()
	end,
})

-- Forcefully stop treesitter for markdown to prevent crashes
vim.api.nvim_create_autocmd("FileType", {
	pattern = { "markdown" },
	callback = function(args)
		pcall(vim.treesitter.stop, args.buf)
	end,
})

--local function pdf_of(file)
--	return vim.fn.fnamemodify(file, ":r") .. ".pdf"
--end
--
--vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
--	pattern = "*.typ",
--	callback = function()
--		local file = vim.fn.expand("%:p")
--		local pdf = pdf_of(file)
--
--		vim.fn.jobstart({
--			"typst",
--			"compile",
--			file,
--			pdf,
--		}, { detach = true })
--
--		vim.fn.jobstart({
--			"sioyek",
--			pdf,
--		}, { detach = true })
--	end,
--})