summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/autocmds.lua
blob: 1b8751c9a4e8842f8d47c4d7903669ba36dbceac (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- ┌─────────────────────────┐
-- │      ▐              ▌   │
-- │▝▀▖▌ ▌▜▀ ▞▀▖▞▀▖▛▚▀▖▞▀▌▞▀▘│
-- │▞▀▌▌ ▌▐ ▖▌ ▌▌ ▖▌▐ ▌▌ ▌▝▀▖│
-- │▝▀▘▝▀▘ ▀ ▝▀ ▝▀ ▘▝ ▘▝▀▘▀▀ │
-- └─────────────────────────┘

local au = require('au')

au.TextYankPost = function()
    vim.highlight.on_yank { higroup="IncSearch", timeout=400 }
end

-- autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences
au.FileType = {
    'vimwiki,latex,tex',
    function()
        vim.bo.formatprg = "/home/yigit/.local/bin/sentences"
    end,
}

-- autocmd VimLeave *.tex !texclear %
au.VimLeave = {
    '*.tex',
    function()
        vim.cmd("!texclear %")
    end,
}

-- autocmd FileType rust let b:dispatch = 'cargo run'
au.FileType = {
    'rust',
    function()
        vim.b.dispatch = 'cargo run'
    end,
}

-- autocmd VimResized * :wincmd =
au.VimResized = {
    '*',
    function()
        vim.cmd(":wincmd =")
    end,
}

-- autocmd FileType markdown,tex setlocal spell
au.FileType = {
    'markdown,text',
    function()
        vim.wo.spell = true
    end,
}

-- gf plugins
au.BufEnter = {
    'init.lua',
    function()
        vim.opt.path:append("./lua")
    end
}

au.BufLeave = {
    'init.lua',
    function()
        vim.opt.path:remove("./lua")
    end
}