summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim/config/lua/utilities.lua
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/custom-neovim/config/lua/utilities.lua')
-rw-r--r--pkgs/custom-neovim/config/lua/utilities.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/custom-neovim/config/lua/utilities.lua b/pkgs/custom-neovim/config/lua/utilities.lua
index 77645ca..d2a26b6 100644
--- a/pkgs/custom-neovim/config/lua/utilities.lua
+++ b/pkgs/custom-neovim/config/lua/utilities.lua
@@ -32,3 +32,20 @@ Utils.generate_theme_from_highlight_groups = function()
background = get_highlight_colors("Normal").bg,
}
end
+
+Utils.link_highlight = function(first_highlight, second_highlight)
+ vim.cmd.highlight {bang = true, "link", first_highlight, second_highlight}
+end
+
+Utils.replaceInTable = function(t, str1, str2)
+ for key, value in pairs(t) do
+ if type(value) == "string" then
+ -- Replace <C-w> with <leader>w in the string
+ t[key] = value:gsub(str1, str2)
+ elseif type(value) == "table" then
+ -- Recursively process nested tables
+ Utils.replaceInTable(value, str1, str2)
+ end
+ end
+ return t
+end