You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.7 KiB
Lua

return function()
-- detect filetype
vim.filetype.add({extension = {ua = "uiua" }})
vim.api.nvim_create_augroup("aprzn", {clear = true})
vim.api.nvim_create_autocmd("BufWritePost", {
group = "aprzn",
pattern = {"*/nvim/*.lua", "*/nvim/lua/*.lua"},
command = "source $MYVIMRC"
}) -- reload config file on save
-- vim.api.nvim_create_autocmd("VimEnter", {
-- group = "aprzn",
-- pattern = {"*"},
-- command = "NERDTree"
-- }) -- open nerdtree on start
vim.api.nvim_create_autocmd("CursorHold", {
group = "aprzn",
pattern = {"*"},
command = "call CocActionAsync('highlight')"
}) -- highlight matching tokens when not moving cursor
vim.api.nvim_create_autocmd("ColorScheme", {
group = "aprzn",
pattern = {"*"},
callback = function(ev)
local file = io.open(vim.fn.stdpath('config') .. "/colorscheme", "w")
local cs = ev.match
file:write(cs)
file:close()
end
}) -- save colorscheme
vim.api.nvim_create_autocmd("BufWritePost", {
group = "aprzn",
pattern = "*.ua",
callback = function(ev)
vim.cmd("silent !uiua fmt " .. vim.fn.expand("<amatch>"))
end,
}) -- format uiua on save
vim.api.nvim_create_autocmd("FileType", {
group = "aprzn",
pattern = "*",
callback = function(ev)
if vim.g.neovide then
if ev.match == "uiua" then -- use uiua386 when editing uiua
vim.o.guifont = "Uiua386:h14"
vim.opt_local.commentstring = "# %s"
else
vim.o.guifont = "FiraCode Nerd Font:h14"
end
end
end,
})
end