diff options
author | Yigit Sever | 2023-09-03 20:57:25 +0300 |
---|---|---|
committer | Yigit Sever | 2023-09-03 20:57:25 +0300 |
commit | 45ce7dd6fe5872983ab27ba354391397a61809ef (patch) | |
tree | 7a351a6f1be4c365742aebba8a1fd6ee2b69fe6a | |
parent | f69e8f3c3259460fe6842a951c8c4d2728a67f57 (diff) | |
download | dotfiles-45ce7dd6fe5872983ab27ba354391397a61809ef.tar.gz dotfiles-45ce7dd6fe5872983ab27ba354391397a61809ef.tar.bz2 dotfiles-45ce7dd6fe5872983ab27ba354391397a61809ef.zip |
nvim: port autocmds
-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 | }) | ||