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/init.lua | 2 ++ .config/nvim/lua/helpers/autocmds.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .config/nvim/lua/helpers/autocmds.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index eacfbf4..b55e65a 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -11,5 +11,7 @@ require("core.keymaps") require("core.lazy") +require("helpers.autocmds") + -- I have to clean this require('helpers.stale').setup{} 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