diff options
author | Chris <[email protected]> | 2021-03-14 16:55:38 -0400 |
---|---|---|
committer | Chris <[email protected]> | 2021-03-14 16:55:38 -0400 |
commit | 7fcb36f16dc85c91b82bee83d30754fc970574dc (patch) | |
tree | 45061124a5c7b2defe56f40dbe3feb40d247bff6 /lua/utils.lua | |
parent | 8de9592cb654fe81c2732608c8ba9051399583ef (diff) |
lotsa cool updates
Diffstat (limited to 'lua/utils.lua')
-rw-r--r-- | lua/utils.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lua/utils.lua b/lua/utils.lua new file mode 100644 index 00000000..59c905f1 --- /dev/null +++ b/lua/utils.lua @@ -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})'}, + }, + } +) + |