From 45ce7dd6fe5872983ab27ba354391397a61809ef Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 3 Sep 2023 20:57:25 +0300 Subject: nvim: port autocmds --- .config/nvim/lua/helpers/autocmds.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .config/nvim/lua/helpers/autocmds.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/helpers/autocmds.lua b/.config/nvim/lua/helpers/autocmds.lua new file mode 100644 index 0000000..b57f64e --- /dev/null +++ b/.config/nvim/lua/helpers/autocmds.lua @@ -0,0 +1,31 @@ +local function augroup(name) + return vim.api.nvim_create_augroup("custom_" .. name, {}) +end + +vim.api.nvim_create_autocmd("FileType", { + group = augroup("use_sentences"), + pattern = { + "vimwiki", + "latex", + "tex", + }, + callback = function() + vim.bo.formatprg = "/home/yigit/.local/bin/sentences" + end, +}) + +vim.api.nvim_create_autocmd("VimLeave", { + group = augroup("tex_clear"), + pattern = { + '*.tex', + }, + command = "!textclear %", +}) + +vim.api.nvim_create_autocmd("VimResized", { + group = augroup("sane_windows"), + pattern = { + '*.*', + }, + command = "wincmd =", +}) -- cgit v1.2.3-70-g09d2