Skip to content

Instantly share code, notes, and snippets.

@nd3w
Last active April 15, 2024 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nd3w/3dfe40b09106b9685ae3bb517b219757 to your computer and use it in GitHub Desktop.
Save nd3w/3dfe40b09106b9685ae3bb517b219757 to your computer and use it in GitHub Desktop.
VSCode Ref

Search and Replace

Search and replace PHP variable in if control structure using regex:

if \(isset\(\$([a-zA-Z_]+)\)\) \{

Replace pattern

if (isset($$$1) AND $$$1 !== '') {

Search for array(anything):

 array\((.*)\)\)

Replace with:

 [$1])

Find multiple lines for array( ... multiple lines ... ):

 array\(([\n\s\S]*?)\)

Replace with:

 [$1]

But this regex will fail if the string is in this pattern below:

 array(
     ($integer - 1),
     $string
 )

Keyboard Shortcuts

Source: Dev.to

Quick Navigation

Ctrl+P - This is your go-to shortcut for quickly opening files. Need to jump into a file without clicking through the sidebar? Ctrl + P to the rescue!

Ctrl + P - This is your go-to shortcut for quickly opening files. Need to jump into a file without clicking through the sidebar? Ctrl + P to the rescue!

Ctrl + B - Quickly toggle the file explorer to show or hide files. A handy way to manage your project structure.

Ctrl + ~ - Open and close the integrated terminal with a quick keystroke. Run commands without leaving your coding environment!

Ctrl + 2 - Split the editor window into two panes. Perfect for comparing files or keeping an eye on different parts of your codebase.

Ctrl + W - Close the currently active file tab. Clean up your workspace in a snap!

Editing Magic

Ctrl + D - Select the next occurrence of the current word. Perfect for quickly editing multiple instances! To skip a selection after hitting Ctrl + D, use Ctrl + K and then Ctrl + D.

Ctrl + Shift + L - Select all occurrences of the current selection. This one is a game-changer for mass editing.

Ctrl + Shift + K - Need to delete a line? Just press this and poof! It's gone!

Shift + Option + Down - Duplicate the current line downwards. Super useful for repeating or rearranging code!

Super Fast Navigation

Ctrl + G - Jump to a specific line. No more endless scrolling!

Ctrl + ] / - Indent lines to the right or left. Keep your code nice and tidy.

Ctrl + / - Toggle line comment. Comment and uncomment with lightning speed!

Ctrl + Shift + O - Instantly navigate to symbols in your code. Functions, classes, variables - find them all in a jiffy!

Useful General Shortcuts

Ctrl + Shift + V - Preview Markdown files instantly. Great for checking your READMEs.

Ctrl + K, Ctrl + S - Open Keyboard Shortcuts. Want to customize your shortcuts? Dive into this menu.

Ctrl + - Toggle the integrated terminal. Need to run a quick command? Just a keystroke away!

Ctrl + 2 - Focus into the second editor group. Handy when working with split views!

Ctrl + K + 1 - Fold all code blocks

Ctrl + K + J - Unfold all code blocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment