1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 11:24:55 +02:00
dotfiles/nvim/lua/config/commands.lua

13 lines
371 B
Lua

-- Nice command that creates all directores in the path
-- then creates the file and opens it.
vim.api.nvim_create_user_command('CreateFile',
function(opts)
local dir = vim.fs.dirname(opts.fargs[1])
vim.cmd(string.format("!mkdir -p %s\n !touch %s", dir, opts.fargs[1]))
vim.cmd.e(opts.fargs)
end,
{ nargs = 1, complete = "file" }
)
vim.cmd("ca cf CreateFile")