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