diff --git a/init.lua b/init.lua index 3bdb5e36..8572617d 100644 --- a/init.lua +++ b/init.lua @@ -188,18 +188,20 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the lower win vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode +-- NOTE: Displays a colored highlight when you yank (copy) or delete text in Neovim + +-- Choose what color the highlight should be: guibg=#40005b (hexidecimal color code) +-- Choose how long the highlight appears: timeout=400 (value is in milliseconds) +vim.api.nvim_exec([[ + augroup YankHighlight + autocmd! + autocmd TextYankPost * silent! lua vim.highlight.on_yank {higroup="YankHighlight",timeout=400} + augroup END + hi YankHighlight guibg=#40005b ctermbg=0 +]], false) +-- See `:help lua-guide-autocommands` -- See `:help vim.highlight.on_yank()` -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info @@ -841,5 +843,6 @@ require('lazy').setup({ }, }) + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et