Created
June 26, 2024 23:05
-
-
Save ninmonkey/8218a0782cf4f01a2d6292ca393e292e to your computer and use it in GitHub Desktop.
Kinda Fancy VsCode Snippets.json 2024-06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
I use these a lot to fix paths in files for github, like markdown links. | |
*/ | |
{ | |
"🐒🦍path: Wraps selected text with a file uri": { | |
"prefix": "insertFileUrl fileUrl", | |
"description": "🦍 wraps selected text with a file url like: <file:///foo.txt> . Note: Currently wraps, does not convert spaces", | |
"body": [ | |
"<file:///${TM_SELECTED_TEXT:foobar.txt}>$0" | |
] | |
}, | |
"🐒🦍regex: Escapes Spaces with %20 for filepath urls": { | |
"prefix": "replaceSpace fixSpace", | |
"description": "🦍 Replaces spaces in selected text with %20 . For example filepath formats <file:///>", | |
"body": [ | |
"${TM_SELECTED_TEXT/ /%20/g}" | |
] | |
}, | |
"🐒🦍regex: Undo Escapes Spaces with %20 for filepath urls": { | |
"prefix": "undoReplaceSpace undoFixSpace", | |
"description": "🦍 Converts %20 escaped filepaths back into spaces. For example filepath formats <file:///>", | |
"body": [ | |
"${TM_SELECTED_TEXT/%20/ /g}" | |
] | |
// example inp: <file:///H:\data\2024\ninmonkey.com\posted\Using Web APIs in Power Query\2024-05-31-GettingMetadaFromWeb.Contents▸Part1\post.▸Capture-Web.Contents-Metadata.wp_source.html> | |
// example out: <file:///H:\data\2024\ninmonkey.com\posted\Using%20Web%20APIs%20in%20Power%20Query\2024-05-31-GettingMetadaFromWeb.Contents▸Part1\post.▸Capture-Web.Contents-Metadata.wp_source.html> | |
}, | |
"🐒🦍regex: Fix Backslash escaped filepaths": { | |
"prefix": "replaceBackslash fixPath", | |
"description": "🦍 Transforms \\\\ ⇒ /", | |
"body": [ | |
"${TM_SELECTED_TEXT/\\x5c/\\//gi}", // 0x5c is '\' | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment