local fs = require("functions.fs") local function tocamel(s) return string.upper(string.sub(s, 1, 1)) .. string.sub(s, 2) end vim.api.nvim_create_user_command("CreateRandomFile", function() local words = vim.fn.readfile(vim.fs.normalize("~/.config/nvim/assets/words.txt")) local wordsRequests = math.random(2, 4) local wordsFinal = "" for i = 1, wordsRequests do local word = words[math.random(#words)] wordsFinal = wordsFinal .. tocamel(word) end local currentPath = fs.getCurrentPath() local directory = currentPath if vim.fn.isdirectory(currentPath) == 0 then directory = vim.fs.dirname(currentPath) end local path = vim.fs.joinpath(directory, wordsFinal .. ".md") os.execute(string.format('touch "%s"', path)) end, {})