-- Scratch files local scratch = function(extension) os.execute("mkdir -p ~/dev/scratches/") local date = os.date("%Y-%m-%dT%H:%M:%S") local filepath = "~/dev/scratches/scratch_" .. date .. extension vim.cmd("execute 'edit " .. filepath .. "'") end require("util").keymaps({ n = { ["fsw"] = { function() require("telescope.builtin").live_grep({ search_dirs = { "~/dev/scratches/" }, }) end, desc = "Find Words in Scratches", }, ["fsf"] = { function() require("telescope.builtin").find_files({ search_dirs = { "~/dev/scratches/" }, }) end, desc = "Find Scratches", }, ["s"] = { "", desc = "Scratch File" }, ["ss"] = { function() scratch(".txt") end, desc = "New [t]e[xt] scratch file", }, ["sn"] = { function() scratch(".json") end, desc = "New json scratch file", }, ["sm"] = { function() scratch(".md") end, desc = "New [m]ark[d]own scratch file", }, ["sq"] = { function() scratch(".sql") end, desc = "New sql scratch file", }, ["st"] = { function() scratch(".ts") end, desc = "New [t]ype[s]cript scratch file", }, ["sb"] = { function() scratch(".sh") end, desc = "New [sh]ell scratch file", }, ["sj"] = { function() scratch(".js") end, desc = "New [j]ava[s]cript scratch file", }, ["sr"] = { function() scratch(".rs") end, desc = "New [r]u[s]t scratch file", }, }, })