summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/helpers/autocmds.lua
blob: 11f448054cc2892d371628fe4ae8813b461b2442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 = "!texclear %",
})

vim.api.nvim_create_autocmd("VimResized", {
    group = augroup("sane_windows"),
    pattern = {
        '*.*',
    },
    command = "wincmd =",
})