aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/cmds.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/cmds.lua')
-rw-r--r--.config/nvim/lua/cmds.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/nvim/lua/cmds.lua b/.config/nvim/lua/cmds.lua
new file mode 100644
index 0000000..1426b99
--- /dev/null
+++ b/.config/nvim/lua/cmds.lua
@@ -0,0 +1,20 @@
+local M = {}
+local fn = vim.fn
+
+local function cabbrev(input, replace)
+ local cmd = 'cnoreabbrev <expr> %s v:lua.cmds.command("%s", "%s")'
+
+ vim.cmd(cmd:format(input, input, replace))
+end
+
+function M.command(cmd, match)
+ if fn.getcmdtype() == ":" and fn.getcmdline():match("^" .. cmd) then
+ return match
+ else
+ return cmd
+ end
+end
+
+cabbrev("vs", "vert sb")
+
+return M