VS Code Search and Explorer Cheat Sheet

Sidebar

Programming ยท VS Code Search and Explorer Cheat Sheet

The search.* and explorer.* settings: what search looks at, how results appear, and how the file tree behaves. Exact ID, what it does, and its default. Sheet 4 in the VS Code series.

Search Shortcuts

Ctrl+Shift+FFind in Files: search the whole workspace
Ctrl+Shift+HReplace in Files
Alt+C / Alt+W / Alt+RToggle match case / whole word / regular expression in the search box
Ctrl+PQuick Open: jump to a file by (part of) its name
Ctrl+Shift+O / Ctrl+TGo to a symbol in this file / in the workspace
Ctrl+Shift+EFocus the Explorer

What Search Looks At

search.excludeGlobs skipped by search; default skips **/node_modules, **/bower_components and **/*.code-search
search.useIgnoreFilestrue (default): respect .gitignore and .ignore files
search.useParentIgnoreFilesAlso read ignore files in parent folders (default false)
search.useGlobalIgnoreFilesAlso read your global ignore file (default false)
search.followSymlinksFollow symbolic links while searching (default true)
search.smartCasetrue: all-lowercase search ignores case, any capital makes it exact (default false)
search.maxResultsUpper limit on results shown (default 20000)

Search Results Display

search.sortOrderdefault, fileNames, type, modified, countDescending, countAscending
search.defaultViewModelist (default) or tree
search.collapseResultsalwaysExpand (default), auto, alwaysCollapse
search.showLineNumbersShow line numbers beside results (default false)
search.useReplacePreviewOpen the preview when you replace a match (default true)
search.actionsPositionWhere the result action buttons sit: right (default) or auto
search.decorations.colors / .badgesColour and badge decorations in results (default true for both)

Search Triggers & Quick Open

search.searchOnTypetrue (default): results update as you type
search.searchOnTypeDebouncePeriodWait in ms before searching while you type (default 300)
search.seedWithNearestWordPre-fill the box with the word at the cursor (default false)
search.seedOnFocusPre-fill with the editor selection when the view is focused (default false)
search.quickOpen.includeSymbolsQuick Open also lists workspace symbols (default false)
search.quickOpen.includeHistoryQuick Open lists recently opened files (default true)
search.quickAccess.preserveInputRemember the last Quick Open text (default false)
search.searchEditor.doubleClickBehaviourgoToLocation (default), selectWord, openLocationToSide

Explorer Display

explorer.compactFoldersShow single-child folder chains as one line, a/b/c (default true)
explorer.sortOrderdefault, mixed, filesFirst, type, modified, foldersNestsFiles
explorer.sortOrderLexicographicOptionsUpper/lower case ordering: default, upper, lower, unicode
explorer.openEditors.visibleHow many entries the Open Editors pane shows (default 9)
explorer.expandSingleFolderWorkspacesAuto-expand a workspace made of one folder (default true)
explorer.decorations.colors / .badgesGit/problem colours and badges in the tree (default true for both)
explorer.copyRelativePathSeparatorSeparator when copying a relative path: /, \ or auto (default)

Explorer Behaviour

explorer.autoRevealSelect the active file in the tree: true (default), false, focusNoScroll
explorer.autoRevealExcludeFiles not revealed automatically; default **/node_modules and **/bower_components
explorer.confirmDeleteAsk before deleting (default true)
explorer.confirmDragAndDropAsk before moving by drag and drop (default true)
explorer.enableDragAndDropAllow drag and drop in the tree (default true)
explorer.enableUndoCtrl+Z undoes Explorer file actions (default true)
explorer.incrementalNamingName for a pasted duplicate: simple (default), smart, disabled

File Nesting & Hiding

explorer.fileNesting.enabledGroup related files under a parent, e.g. app.js under app.ts (default false)
explorer.fileNesting.expandShow nested groups expanded (default true)
explorer.fileNesting.patternsRules for nesting, e.g. { "*.ts": "${capture}.js" }
explorer.excludeGitIgnoreHide anything your .gitignore lists (default false)
files.excludeGlobs hidden from the Explorer entirely; see sheet 2 (Files and Auto Save)

A Reasonable Starter Set (my suggestions, not defaults)

"search.smartCase": trueCase-insensitive until you type a capital
"search.seedWithNearestWord": trueCtrl+Shift+F starts with the word under the cursor
"explorer.confirmDelete": falseFewer prompts, since the Recycle Bin and Ctrl+Z still protect you
"explorer.compactFolders": falseEvery folder level visible, if the chains confuse you
"explorer.fileNesting.enabled": trueTidier tree in web and TypeScript projects
"search.showLineNumbers": trueEasier to tell matches apart
Search can't find a file or text you know is there
Three things hide files from search: search.exclude, the files.exclude setting, and your .gitignore (because search.useIgnoreFiles is on). In the search panel, open the details with the ... button (Ctrl+Shift+J) and look at the files to exclude box and the Use Exclude Settings and Ignore Files toggle. Turning that toggle off searches everything, including folders such as node_modules.