18 lines
522 B
Lua
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' })
|