diff options
-rw-r--r-- | .config/nvim/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/helpers/autocmds.lua | 31 |
2 files changed, 33 insertions, 0 deletions
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") | |||
11 | 11 | ||
12 | require("core.lazy") | 12 | require("core.lazy") |
13 | 13 | ||
14 | require("helpers.autocmds") | ||
15 | |||
14 | -- I have to clean this | 16 | -- I have to clean this |
15 | require('helpers.stale').setup{} | 17 | 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 @@ | |||
1 | local function augroup(name) | ||
2 | return vim.api.nvim_create_augroup("custom_" .. name, {}) | ||
3 | end | ||
4 | |||
5 | vim.api.nvim_create_autocmd("FileType", { | ||
6 | group = augroup("use_sentences"), | ||
7 | pattern = { | ||
8 | "vimwiki", | ||
9 | "latex", | ||
10 | "tex", | ||
11 | }, | ||
12 | callback = function() | ||
13 | vim.bo.formatprg = "/home/yigit/.local/bin/sentences" | ||
14 | end, | ||
15 | }) | ||
16 | |||
17 | vim.api.nvim_create_autocmd("VimLeave", { | ||
18 | group = augroup("tex_clear"), | ||
19 | pattern = { | ||
20 | '*.tex', | ||
21 | }, | ||
22 | command = "!textclear %", | ||
23 | }) | ||
24 | |||
25 | vim.api.nvim_create_autocmd("VimResized", { | ||
26 | group = augroup("sane_windows"), | ||
27 | pattern = { | ||
28 | '*.*', | ||
29 | }, | ||
30 | command = "wincmd =", | ||
31 | }) | ||