feat(nvim): add autocmd to set terminal opts

This commit is contained in:
Price Hiller 2023-08-31 21:36:22 -05:00
parent 7fb445b742
commit 395bf77a2c
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -1,8 +1,10 @@
local M = {}
M.setup = function()
local augroup = vim.api.nvim_create_augroup("user-autocmds", { clear = true })
-- NOTE: Highlight text yanked
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup,
callback = function()
vim.highlight.on_yank()
end,
@ -10,8 +12,22 @@ M.setup = function()
-- NOTE: Remove trailing whitespace on save
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
command = "%s/\\s\\+$//e",
})
-- NOTE: Disables status column elements in Terminal buffer
vim.api.nvim_create_autocmd("TermOpen", {
group = augroup,
callback = function()
vim.api.nvim_set_option_value("statuscolumn", "", { scope = "local" })
vim.api.nvim_set_option_value("signcolumn", "no", { scope = "local" })
vim.api.nvim_set_option_value("number", false, { scope = "local" })
vim.api.nvim_set_option_value("relativenumber", false, { scope = "local" })
vim.cmd.startinsert()
end
})
end
return M