nvim-lua.kickstart.nvim/lua/custom/autocommands.lua

24 lines
719 B
Lua
Raw Normal View History

2024-09-25 22:34:37 +02:00
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
2024-12-16 07:44:33 +01:00
vim.api.nvim_create_user_command('FormatDisable', function()
vim.g.disable_autoformat = true
end, {
desc = 'Disable autoformat-on-save',
})
vim.api.nvim_create_user_command('FormatEnable', function()
vim.g.disable_autoformat = false
end, {
desc = 'Re-enable autoformat-on-save',
})