diff options
Diffstat (limited to '.config/nvim/lua/cmds.lua')
-rw-r--r-- | .config/nvim/lua/cmds.lua | 20 |
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 |