dotfiles/config/linux-dev/nvim/lua/config/autocmds.lua
2025-10-20 16:52:01 +03:00

18 lines
522 B
Lua

-- Highlight when yanking (copying) text
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
})
-- Set filetype on new buffers
vim.api.nvim_create_user_command('Capture', function(opts)
local out = vim.fn.execute(opts.args)
vim.cmd('enew')
vim.bo.buftype = 'nofile'
vim.bo.bufhidden = 'hide'
vim.bo.swapfile = false
vim.bo.filetype = 'capture'
vim.api.nvim_buf_set_lines(0, 0, -1, false, vim.split(out, '\n'))
end, { nargs = '+', complete = 'command' })