From 057c706699af674eab011f261206229e4722f46e Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sun, 7 Apr 2024 18:59:50 +0100 Subject: [PATCH] Add :Mkdir command to create directories --- lua/commands.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/commands.lua b/lua/commands.lua index 1ef8069..e367a28 100644 --- a/lua/commands.lua +++ b/lua/commands.lua @@ -101,7 +101,14 @@ end, { -- TODO: :Chmod --- TODO: :Mkdir +-- :Mkdir create a directory, bang to create intermediate directories +vim.api.nvim_create_user_command('Mkdir', function(opts) + local flags = nil + if opts.bang then + flags = 'p' + end + vim.fn.mkdir(opts.args, flags) +end, { bang = true, nargs = 1 }) -- :Rg grep for the given string and fuzzy find the results, bang to enable -- regex in given string