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 return { n = { [""] = { "zz", desc = "Vertical half page down and center cursor" }, [""] = { "zz", desc = "Vertical half page up and center cursor" }, ["gf"] = { ":OpenInGHFile ", desc = "Open in github" }, ["m"] = { name = " Markdown" }, ["mp"] = { ":Glow ", desc = "Markdown preview" }, ["y"] = { '"*y', desc = "Copy to system clipboard" }, ["p"] = { '"*p', desc = "Paste from system clipboard" }, ["fs"] = { function() require("telescope.builtin").live_grep { search_dirs = { "~/dev/scratches/" }, } end, desc = "Find words in scratches", }, ["s"] = { name = " Scratch File" }, ["ss"] = { function() scratch ".txt" end, desc = "New text scratch file" }, ["sn"] = { function() scratch ".json" end, desc = "New json scratch file" }, ["sq"] = { function() scratch ".sql" end, desc = "New sql scratch file" }, ["st"] = { function() scratch ".ts" end, desc = "New ts scratch file" }, ["sb"] = { function() scratch ".sh" end, desc = "New shell scratch file" }, ["sj"] = { function() scratch ".js" end, desc = "New js scratch file" }, ["∆"] = { ":m .+1==g", desc = "Move the line up", }, ["˚"] = { ":m .-2==g", desc = "Move the line down", }, }, v = { ["gf"] = { ":OpenInGHFile ", desc = "Open in github" }, ["y"] = { '"*y', desc = "Copy to system clipboard" }, ["p"] = { '"*p', desc = "Paste from system clipboard" }, ["∆"] = { cmd = ":m '>+1gv=gv", desc = "Move the selected text up", }, ["˚"] = { cmd = ":m '<-2gv=gv", desc = "Move the selected text down", }, }, x = { ["∆"] = { cmd = ":m '>+1gv=gv", desc = "Move the selected text up", }, ["˚"] = { desc = "Move the selected text down", cmd = ":m '<-2gv=gv", }, }, i = { [""] = { "", desc = "Up" }, [""] = { "", desc = "Down" }, [""] = { "", desc = "Left" }, [""] = { "", desc = "Right" }, }, c = { [""] = { "", desc = "Left" }, [""] = { "", desc = "Down" }, [""] = { "", desc = "Up" }, [""] = { "", desc = "Right" }, }, }