summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom/globals.lua
blob: 25f26d17c873727258c02d543d66852cbc1dc014 (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
function Notify(message, title, level)
    if not title then
        if not level then
            title = 'info'
        else
            title = level
        end
    end
    vim.notify(message, level, { title = ' ' .. title })
end

function ToggleWrap()
    if vim.wo.wrap then
        vim.wo.wrap = false
        Notify('Wrap disabled')
    else
        vim.wo.wrap = true
        vim.wo.number = false
        Notify('Wrap enabled')
    end
end

function ToggleInlayHints()
    local is_enabled = vim.lsp.inlay_hint.is_enabled({})
    vim.lsp.inlay_hint.enable(not is_enabled)
    if is_enabled then
        Notify('Inlay Hints disabled')
    else
        Notify('Inlay Hints enabled')
    end
end