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 = { [";"] = { ":", desc = "Fast ;command mode"}, ["a"] = {"ggVG"}, [""] = { "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", }, ["r"] = { function() require("rest-nvim").run() end, desc = "Send http request" }, ["Q"] = { ":qa", desc = "Quit all" }, [","] = { name = " Misc Tools" }, [",c"] = { name = " Casing" }, [",cs"] = { ":Snek", desc = "To Snek Case" }, [",cc"] = { ":Camel", desc = "To Camel Case" }, [",cp"] = { ":CamelB", desc = "To Pascal Case" }, [",ck"] = { ":Kebab", desc = "To Kebab Case" }, [",ce"] = { ":Screm", desc = "To Screm Case" }, [",j"] = { name = " Jest Tests" }, [",jr"] = { function() require("jester").run() end, desc = "Run test under cursor" }, [",jf"] = { function() require("jester").run_file() end, desc = "Run tests for file" }, [",jl"] = { function() require("jester").run_last() end, desc = "Run last ran test" }, ["lz"] = { ":LspRestart", desc = "Restart LSP Server" }, }, 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", }, [","] = { name = " Misc Tools" }, [",c"] = { name = " Casing" }, [",cs"] = { ":Snek", desc = "To Snek Case" }, [",cc"] = { ":Camel", desc = "To Camel Case" }, [",cp"] = { ":CamelB", desc = "To Pascal Case" }, [",ck"] = { ":Kebab", desc = "To Kebab Case" }, [",ce"] = { ":Screm", desc = "To Screm Case" }, [""] = { '"hy:%s/h//gc', desc = "Replace current selection with confirmations" }, [""] = { '"hy:%s/h//g', desc = "Replace current selection", }, }, 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" }, }, }