Add autocommand for yank highlighting
This commit is contained in:
parent
f6b53b4956
commit
13564f5517
@ -1,3 +1,6 @@
|
|||||||
|
local augroup = vim.api.nvim_create_augroup
|
||||||
|
local aucmd = vim.api.nvim_create_autocmd
|
||||||
|
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
@ -17,14 +20,27 @@ vim.opt.foldlevelstart = 99
|
|||||||
|
|
||||||
vim.opt.fillchars:append({ eob = "·" })
|
vim.opt.fillchars:append({ eob = "·" })
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({"InsertEnter", "InsertLeave", "BufEnter"}, {
|
-- yank to clipboard, requires wl-copy command or equivalent
|
||||||
|
vim.opt.clipboard:append("unnamedplus")
|
||||||
|
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
|
||||||
|
augroup("valeth", { clear = true })
|
||||||
|
|
||||||
|
-- Temporarily highlight yanked text
|
||||||
|
aucmd("TextYankPost", {
|
||||||
|
group = "valeth",
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank({ timeout = 500 })
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Hide cursor line while in insert mode
|
||||||
|
aucmd({"InsertEnter", "InsertLeave", "BufEnter"}, {
|
||||||
|
group = "valeth",
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local entered_insert_mode = args.event == "InsertEnter"
|
local entered_insert_mode = args.event == "InsertEnter"
|
||||||
vim.opt.cursorline = not entered_insert_mode
|
vim.opt.cursorline = not entered_insert_mode
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- yank to clipboard, requires wl-copy command or equivalent
|
|
||||||
vim.opt.clipboard:append("unnamedplus")
|
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
|
Loading…
Reference in New Issue
Block a user