.config/nvim/lua/config/util.lua

changeset 1095
226221dc1d6b
parent 1085
c2d11f022cf0
child 1156
0a7162df160d
--- a/.config/nvim/lua/config/util.lua
+++ b/.config/nvim/lua/config/util.lua
@@ -1,18 +1,19 @@
 local M = {}
 
-local api = vim.api
-local fn = vim.fn
+local api, fn = vim.api, vim.fn
 
-function M.calias(abbrev, expand)
-  vim.cmd.cnoreabbrev(
-    string.format(
-      [[<expr> %s (getcmdtype() == ":" && getcmdline() == "%s") ? "%s" : "%s"]],
-      abbrev,
-      abbrev,
-      expand,
-      abbrev
+function M.calias(aliases)
+  for abbrev, expand in pairs(aliases) do
+    vim.cmd.cnoreabbrev(
+      string.format(
+        [[<expr> %s (getcmdtype() == ":" && getcmdline() == "%s") ? "%s" : "%s"]],
+        abbrev,
+        abbrev,
+        expand,
+        abbrev
+      )
     )
-  )
+  end
 end
 
 function M.autocmd(group, event, pattern, opts)

mercurial