mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-07-13 02:44:43 +02:00
lotsa cool updates
This commit is contained in:
parent
8de9592cb6
commit
7fcb36f16d
5 changed files with 91 additions and 1 deletions
29
lua/utils.lua
Normal file
29
lua/utils.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local function define_augroups(definitions) -- {{{1
|
||||
-- Create autocommand groups based on the passed definitions
|
||||
--
|
||||
-- The key will be the name of the group, and each definition
|
||||
-- within the group should have:
|
||||
-- 1. Trigger
|
||||
-- 2. Pattern
|
||||
-- 3. Text
|
||||
-- just like how they would normally be defined from Vim itself
|
||||
for group_name, definition in pairs(definitions) do
|
||||
vim.cmd('augroup ' .. group_name)
|
||||
vim.cmd('autocmd!')
|
||||
|
||||
for _, def in pairs(definition) do
|
||||
local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ')
|
||||
vim.cmd(command)
|
||||
end
|
||||
|
||||
vim.cmd('augroup END')
|
||||
end
|
||||
end
|
||||
|
||||
define_augroups(
|
||||
{_general_settings = {
|
||||
{'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'IncSearch\', timeout = 200})'},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue