summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom/config/autocmds.lua
blob: a9a9dc0059a66576aa86fc78c3da9e74a9d8bf88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
vim.api.nvim_create_autocmd('TextYankPost', {
    desc = 'Highlight when yanking text',
    group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
    callback = function()
        vim.highlight.on_yank()
    end,
})

vim.api.nvim_create_autocmd('BufEnter', {
    desc = 'Disable newlines on commented lines from continuing the comment',
    group = vim.api.nvim_create_augroup('disable-comments-continuation', { clear = true }),
    callback = function()
        -- vim.opt_local.formatoptions:remove('r') -- no comments on enter
        vim.opt_local.formatoptions:remove('o') -- no comments on `o` or `O`
    end,
})