Dot_Files/.config/nvim/lua/core/autocmds.lua

29 lines
748 B
Lua
Raw Normal View History

2022-05-11 21:22:25 -05:00
local M = {}
2022-06-02 20:29:48 -05:00
M.setup = function()
-- NOTE: Highlight text yanked
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
})
2022-05-11 21:22:25 -05:00
-- NOTE: Remove trailing whitespace on save
vim.api.nvim_create_autocmd('BufWritePre', {
command = '%s/\\s\\+$//e',
})
-- -- NOTE: Handles scenarios in which the filetype isn't detected on load
-- vim.api.nvim_create_autocmd('BufReadPost', {
-- pattern = '*',
-- callback = function()
-- local opt_ft = vim.opt_local.ft:get()
-- if opt_ft == nil or opt_ft == '' then
-- vim.cmd('filetype detect')
-- end
-- end,
-- })
2022-05-11 21:22:25 -05:00
end
return M