{
"workbench.colorTheme": "Tokyo Night",
"workbench.colorCustomizations": {
"editor.background": "#000000",
"sideBar.background": "#000000",
"terminal.background": "#000000",
"activityBar.background": "#000000",
"activityBar.border": "#000000",
"activityBar.activeBorder": "#000000",
"dropdown.background": "#000000",
"dropdown.listBackground": "#000000",
"dropdown.border": "#000000",
"editorPane.background": "#000000",
"editor.compositionBorder": "#000000",
"editor.findMatchBackground": "#000000",
"editor.foldBackground": "#000000",
"editorActionList.background": "#000000",
"panel.background": "#000000",
"statusBar.background": "#000000",
"titleBar.activeBackground": "#000000",
"titleBar.inactiveBackground": "#000000",
"panelTitle.activeBorder": "#ff0000",
"editorWidget.background": "#000000",
"debugToolBar.background": "#000000",
"menu.background": "#000000",
"editorGroupHeader.tabsBackground": "#000000",
"breadcrumb.background": "#000000",
"editorGutter.background": "#000000",
"statusBar.background": "#000000",
"statusBar.noFolderBackground": "#000000",
"statusBar.debuggingBackground": "#000000"
},
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"json.validate.enable": false,
"pylint.args": ["--disable=C0116", "--disable=C0111", "--disable=C0114"],
"pylint.args": [
"disable=missing-module-docstring",
"disable=missing-class-docstring",
"disable=missing-function-docstring"
],
{
"python.terminal.activateEnvironment": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/Scripts/python.exe"
},
"json.schemaDownload.enable": true,
"editor.fontFamily": "FiraCode Nerd Font",
"editor.inlayHints.fontFamily": "FiraCode Nerd Font",
"editor.minimap.enabled": false,
"git.autofetch": true,
"files.autoSave": "afterDelay",
"yaml.customTags": [
"!And",
"!And sequence",
"!If",
"!If sequence",
"!Not",
"!Not sequence",
"!Equals",
"!Equals sequence",
"!Or",
"!Or sequence",
"!FindInMap",
"!FindInMap sequence",
"!Base64",
"!Join",
"!Join sequence",
"!Cidr",
"!Ref",
"!Sub",
"!Sub sequence",
"!GetAtt",
"!GetAZs",
"!ImportValue",
"!ImportValue sequence",
"!Select",
"!Select sequence",
"!Split",
"!Split sequence"
],
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": "explicit"
}
},
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.bracketPairColorization.enabled": true,
"editor.codeActionsOnSave": {
"dart.previewFlutterUiGuides": "explicit",
"source.fixAll": "explicit"
},
"editor.stickyScroll.enabled": true,
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": "off"
},
"explorer.copyRelativePathSeparator": "/",
"go.useLanguageServer": true,
"go.formatTool": "gofmt",
"go.lintTool": "golangci-lint",
"go.inferGopath": true,
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.buildTags": "",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave": false,
"go.useLanguageServer": true,
"go.alternateTools": {
"go-langserver": "gopls"
},
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"go.languageServerExperimentalFeatures": {
"format": true,
"autoComplete": true
}
}
},
"go.toolsManagement.autoUpdate": true,
"gopls": {
"ui.semanticTokens": true,
"ui.completion.usePlaceholders": true
},
"dart.previewFlutterUiGuidesCustomTracking": true,
"terminal.integrated.fontFamily": "CaskaydiaCove Nerd Font Mono",
"editor.renderLineHighlight": "none",
"editor.formatOnSave": true,
"editor.cursorStyle": "underline",
"editor.cursorBlinking": "phase",
"editor.bracketPairColorization.enabled": true,
"editor.formatOnType": true,
"terminal.integrated.cursorStyle": "underline",
"terminal.integrated.cursorWidth": 3,
"terminal.integrated.cursorBlinking": true,
"editor.cursorSmoothCaretAnimation": "on",
"security.workspace.trust.untrustedFiles": "open",
"editor.unicodeHighlight.nonBasicASCII": false,
"editor.wordWrap": "on",
"markdownlint.ignore": ["MD010"],
"markdownlint.config": {
"no-hard-tabs": false,
"no-duplicate-heading": false,
"no-duplicate-header": false,
"ol-prefix": false
},
"workbench.iconTheme": "material-icon-theme",
"glassit.alpha": 255,
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"vscode-edge-devtools.webhintInstallNotification": true,
"editor.codeLensFontFamily": "FiraCode Nerd Font",
"terminal.integrated.fontSize": 15,
"notebook.output.fontFamily": "FiraCode Nerd Font",
"errorLens.fontFamily": "CaskaydiaCove Nerd Font Mono",
"window.customTitleBarVisibility": "windowed",
"workbench.settings.applyToAllProfiles": [],
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"python.analysis.typeCheckingMode": "standard",
"editor.largeFileOptimizations": false,
"editor.codeLensFontSize": 16,
"telemetry.telemetryLevel": "off",
"editor.fontSize": 16
}
{
"workbench.colorTheme": "Tokyo Night",
"workbench.colorCustomizations": {
"editor.background": "#000000",
"sideBar.background": "#000000",
"terminal.background": "#000000",
"activityBar.background": "#000000",
"activityBar.border": "#000000",
"activityBar.activeBorder": "#000000",
"dropdown.background": "#000000",
"dropdown.listBackground": "#000000",
"dropdown.border": "#000000",
"panel.background": "#000000",
"statusBar.background": "#000000",
"titleBar.activeBackground": "#000000",
"titleBar.inactiveBackground": "#000000",
"panelTitle.activeBorder": "#ff0000",
"debugToolBar.background": "#000000",
"menu.background": "#000000",
"editorGroupHeader.tabsBackground": "#000000",
"breadcrumb.background": "#000000",
"editorGutter.background": "#000000"
},
"json.validate.enable": false,
"json.schemaDownload.enable": true,
"editor.fontFamily": "FiraCode Nerd Font",
"editor.inlayHints.fontFamily": "FiraCode Nerd Font",
"editor.minimap.enabled": false,
"editor.fontSize": 16,
"git.autofetch": true,
"files.autoSave": "afterDelay",
"editor.stickyScroll.enabled": true,
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": "off",
"redhat.telemetry.enabled": flase,
"explorer.copyRelativePathSeparator": "/",
"go.formatTool": "gofmt",
"go.lintTool": "golangci-lint",
"go.inferGopath": false,
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.buildTags": "",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave": false,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.gocodeAutoBuild": true,
"go.useLanguageServer": true,
"go.alternateTools": {
"go-langserver": "gopls"
},
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"go.languageServerExperimentalFeatures": {
"format": true,
"autoComplete": true
}
}
},
"go.toolsManagement.autoUpdate": true,
"gopls": {
"ui.semanticTokens": true,
"ui.completion.usePlaceholders": true
},
"terminal.integrated.fontFamily": "FiraCode Nerd Font",
"editor.formatOnSave": true,
"editor.cursorStyle": "underline",
"editor.cursorBlinking": "phase",
"editor.bracketPairColorization.enabled": true,
"editor.formatOnType": true,
"terminal.integrated.cursorStyle": "underline",
"terminal.integrated.cursorWidth": 3,
"terminal.integrated.cursorBlinking": true,
"editor.renderLineHighlight": "none",
"editor.cursorSmoothCaretAnimation": "on",
"security.workspace.trust.untrustedFiles": "open",
"editor.unicodeHighlight.nonBasicASCII": false,
"editor.wordWrap": "on",
"markdownlint.ignore": [
"MD010"
],
"markdownlint.config": {
"no-hard-tabs": false,
"no-duplicate-heading": false,
"no-duplicate-header": false,
"ol-prefix": false
},
"workbench.iconTheme": "material-icon-theme",
"editor.codeLensFontFamily": "FiraCode Nerd Font",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"terminal.integrated.fontSize": 15,
"files.autoSaveDelay": 500,
"makefile.configureOnOpen": true
}
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "Tokyo Night",
"workbench.colorCustomizations": {
"editor.background": "#000000",
"sideBar.background": "#000000",
"terminal.background": "#000000",
"activityBar.background": "#000000",
"activityBar.border": "#000000",
"activityBar.activeBorder": "#000000",
"dropdown.background": "#000000",
"dropdown.listBackground": "#000000",
"dropdown.border": "#000000",
"panel.background": "#000000",
"statusBar.background": "#000000",
"titleBar.activeBackground": "#000000",
"titleBar.inactiveBackground": "#000000",
"panelTitle.activeBorder": "#ff0000",
"debugToolBar.background": "#000000",
"menu.background": "#000000",
"editorGroupHeader.tabsBackground": "#000000",
"breadcrumb.background": "#000000",
"editorGutter.background": "#000000"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"json.validate.enable": true,
"editor.codeLensFontFamily": "FiraCode Nerd Font",
"json.schemaDownload.enable": true,
"editor.fontFamily": "FiraCode Nerd Font",
"editor.inlayHints.fontFamily": "FiraCode Nerd Font",
"git.autofetch": true,
"yaml.customTags": [
"!And",
"!And sequence",
"!If",
"!If sequence",
"!Not",
"!Not sequence",
"!Equals",
"!Equals sequence",
"!Or",
"!Or sequence",
"!FindInMap",
"!FindInMap sequence",
"!Base64",
"!Join",
"!Join sequence",
"!Cidr",
"!Ref",
"!Sub",
"!Sub sequence",
"!GetAtt",
"!GetAZs",
"!ImportValue",
"!ImportValue sequence",
"!Select",
"!Select sequence",
"!Split",
"!Split sequence"
],
"files.autoSave": "afterDelay",
"debug.openDebug": "openOnDebugBreak",
"debug.internalConsoleOptions": "openOnSessionStart",
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.bracketPairColorization.enabled": true,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"editor.stickyScroll.enabled": true,
"editor.selectionHighlight": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": "off"
},
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"editor.minimap.enabled": false,
"dart.enableSdkFormatter": true,
"dart.previewFlutterUiGuides": true,
"dart.previewFlutterUiGuidesCustomTracking": true,
"explorer.fileNesting.patterns": {
"*.dart": "${capture}.g.dart, ${capture}.freezed.dart"
},
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"terminal.integrated.fontFamily": "FiraCode Nerd Font",
"editor.formatOnSave": true,
"editor.bracketPairColorization.enabled": true,
"editor.formatOnType": true,
"terminal.integrated.cursorStyle": "underline",
"terminal.integrated.cursorWidth": 3,
"terminal.integrated.cursorBlinking": true,
"editor.unicodeHighlight.nonBasicASCII": false,
"editor.wordWrap": "on",
"markdownlint.config": {
"no-hard-tabs": false,
"no-duplicate-heading": false,
"no-duplicate-header": false,
"ol-prefix": false
},
"editor.cursorStyle": "underline",
"editor.fontSize": 16,
"editor.cursorSmoothCaretAnimation": "on",
"editor.cursorBlinking": "phase",
"editor.renderLineHighlight": "none",
"editor.codeActionsOnSave": {
"dart.previewFlutterUiGuides": "explicit",
"source.fixAll": "always",
"source.organizeImports": "explicit"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"redhat.telemetry.enabled": false,
"terminal.integrated.fontSize": 15
}
{
"python.analysis.autoImportCompletions": true,
"python.analysis.fixAll": [
"source.unusedImports"
],
{
"python.terminal.activateEnvironment": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/Scripts/python.exe"
},
"pylint.args": [
"--disable=C0116",
"--disable=C0111",
"--disable=C0114",
"--disable=C0103",
"--disable=W0703",
"--disable=C0301",
"--disable=W1203",
],
"powershell.codeFormatting.useCorrectCasing": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"files.exclude": {
"**/__pycache__": true,
"**/.cache": true,
"**/.coverage": true,
"**/.coverage.*": true,
"**/.hypothesis": true,
"**/.mypy_cache": true,
"**/.nox": true,
"**/.pytest_cache": true,
"**/.ruff_cache": true,
"**/.tox": true
},
"workbench.colorTheme": "Tokyo Night",
"workbench.colorCustomizations": {
"editor.background": "#000000",
"sideBar.background": "#000000",
"terminal.background": "#000000",
"activityBar.background": "#000000",
"activityBar.border": "#000000",
"activityBar.activeBorder": "#000000",
"dropdown.background": "#000000",
"dropdown.listBackground": "#000000",
"dropdown.border": "#000000",
"panel.background": "#000000",
"statusBar.background": "#000000",
"titleBar.activeBackground": "#000000",
"titleBar.inactiveBackground": "#000000",
"panelTitle.activeBorder": "#ff0000",
"debugToolBar.background": "#000000",
"menu.background": "#000000",
"editorGroupHeader.tabsBackground": "#000000",
"breadcrumb.background": "#000000",
"editorGutter.background": "#000000",
"notebook.editorBackground": "#000000",
"notebook.selectedCellBackground": "#000000",
"notebook.cellBorderColor": "#000000",
"notebook.focusedCellBackground": "#000000",
"notebook.focusedEditorBorder": "#000000",
"notebook.focusedCellBorder": "#000000",
"notebookEditorOverviewRuler.runningCellForeground": "#000000",
"editorWidget.background": "#000000"
},
"workbench.iconTheme": "material-icon-theme",
"json.validate.enable": false,
"json.schemaDownload.enable": true,
"editor.fontFamily": "FiraCode Nerd Font",
"editor.inlayHints.fontFamily": "CaskaydiaCove NF",
"editor.minimap.enabled": false,
"editor.fontSize": 16,
"git.autofetch": true,
"files.autoSave": "onFocusChange",
"markdownlint.config": {
"no-hard-tabs": false,
"no-duplicate-heading": false,
"no-duplicate-header": false,
"ol-prefix": false
},
"editor.codeLensFontFamily": "FiraCode Nerd Font",
"editor.cursorStyle": "underline",
"debug.console.fontFamily": "CaskaydiaCove Nerd Font",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"terminal.integrated.fontFamily": "FiraCode Nerd Font",
"editor.formatOnSave": true,
"editor.cursorStyle": "underline",
"editor.cursorBlinking": "phase",
"editor.bracketPairColorization.enabled": true,
"editor.formatOnType": true,
"terminal.integrated.cursorStyle": "underline",
"terminal.integrated.cursorWidth": 3,
"terminal.integrated.cursorBlinking": true,
"editor.cursorSmoothCaretAnimation": "on",
"editor.unicodeHighlight.nonBasicASCII": false,
"editor.wordWrap": "on",
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
},
"notebook.formatOnSave.enabled": true,
"notebook.codeActionsOnSave": {
"notebook.source.fixAll": "explicit",
"notebook.source.organizeImports": "explicit"
},
"notebook.formatOnCellExecution": true,
"notebook.formatOnSave.enabled": true,
"redhat.telemetry.enabled": false,
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
"editor.colorDecoratorsLimit": 50000,
"editor.largeFileOptimizations": false,
"editor.unicodeHighlight.invisibleCharacters": false,
"editor.unicodeHighlight.ambiguousCharacters": false,
"xml.symbols.maxItemsComputed": 500000,
"diffEditor.hideUnchangedRegions.enabled": true,
"explorer.copyPathSeparator": "/",
"explorer.copyRelativePathSeparator": "/",
"evenBetterToml.formatter.columnWidth": 0,
"editor.foldingMaximumRegions": 50000,
"json.maxItemsComputed": 500000,
"terminal.integrated.fontSize": 15,
"notebook.markup.fontFamily": "FiraCode Nerd Font",
"notebook.markup.fontSize": 15,
"notebook.output.fontFamily": "FiraCode Nerd Font",
"notebook.output.fontSize": 15,
"dataWrangler.experiments.copilot.enabled": false,
"python.analysis.typeCheckingMode": "standard",
"makefile.configureOnOpen": true,
}
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorCustomizations": {
"editor.background": "#000000",
"sideBar.background": "#000000",
"terminal.background": "#000000",
"activityBar.background": "#000000",
"activityBar.border": "#000000",
"activityBar.activeBorder": "#000000",
"dropdown.background": "#000000",
"dropdown.listBackground": "#000000",
"dropdown.border": "#000000",
"panel.background": "#000000",
"statusBar.background": "#000000",
"titleBar.activeBackground": "#000000",
"titleBar.inactiveBackground": "#000000",
"panelTitle.activeBorder": "#ff0000",
"debugToolBar.background": "#000000",
"menu.background": "#000000",
"editorGroupHeader.tabsBackground": "#000000",
"breadcrumb.background": "#000000",
"editorGutter.background": "#000000"
},
"editor.fontFamily": "FiraCode Nerd Font",
"editor.fontSize": 15,
"terminal.integrated.fontFamily": "FiraCode Nerd Font",
"terminal.integrated.fontSize": 13,
"editor.codeLensFontSize": 10,
"editor.codeLensFontFamily": "FiraCode Nerd Font",
"editor.minimap.enabled": false,
"json.validate.enable": false,
"json.schemaDownload.enable": true,
"editor.inlayHints.fontFamily": "FiraCode Nerd Font",
"editor.minimap.enabled": false,
"files.autoSave": "afterDelay",
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
// Use a specific formatter for JavaScript and TypeScript
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"yaml.customTags": [
"!And",
"!And sequence",
"!If",
"!If sequence",
"!Not",
"!Not sequence",
"!Equals",
"!Equals sequence",
"!Or",
"!Or sequence",
"!FindInMap",
"!FindInMap sequence",
"!Base64",
"!Join",
"!Join sequence",
"!Cidr",
"!Ref",
"!Sub",
"!Sub sequence",
"!GetAtt",
"!GetAZs",
"!ImportValue",
"!ImportValue sequence",
"!Select",
"!Select sequence",
"!Split",
"!Split sequence"
],
"editor.formatOnSave": true,
"editor.cursorStyle": "underline",
"editor.cursorBlinking": "phase",
"editor.renderLineHighlight": "none",
"editor.bracketPairColorization.enabled": true,
"editor.formatOnType": true,
"terminal.integrated.cursorStyle": "underline",
"terminal.integrated.cursorWidth": 3,
"terminal.integrated.cursorBlinking": true,
"editor.cursorSmoothCaretAnimation": "on",
"editor.unicodeHighlight.nonBasicASCII": false,
"editor.wordWrap": "on",
"css.format.spaceAroundSelectorSeparator": true,
"typescript.enablePromptUseWorkspaceTsdk": true,
"files.insertFinalNewline": true,
"npm.packageManager": "pnpm",
"editor.insertSpaces": false,
"files.trimTrailingWhitespace": true,
"markdownlint.config": {
"no-hard-tabs": false,
"no-duplicate-heading": false,
"no-duplicate-header": false,
"ol-prefix": false
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"redhat.telemetry.enabled": false,
"editor.linkedEditing": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"workbench.colorTheme": "Tokyo Night",
"[css]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"errorLens.fontFamily": "FiraCode Nerd Font",
"editor.fontLigatures": true,
"svelte.enable-ts-plugin": true,
"typescript.updateImportsOnFileMove.enabled": "always"
}
# ====================================================================
# PowerShell Profile – Integrated & Enhanced
# ====================================================================
# --- 1. Core Configuration & Encoding ---
[Console]::OutputEncoding = [Text.Encoding]::UTF8
$OutputEncoding = [Text.Encoding]::UTF8
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
$host.UI.RawUI.WindowTitle = "PowerShellCore"
# --- 2. Module Management (reuse your existing logic) ---
function Install-ModuleIfMissing
{
param([Parameter(Mandatory)] [string]$ModuleName)
if (-not (Get-Module -ListAvailable -Name $ModuleName))
{
Write-Warning "Module '$ModuleName' not found."
$install = Read-Host "Install from PS Gallery? (Y/N)"
if ($install -eq 'Y')
{
try
{
Install-Module -Name $ModuleName -Force -Scope CurrentUser -ErrorAction Stop
Write-Host "✔ Successfully installed $ModuleName." -ForegroundColor Green
} catch
{
Write-Error "Failed to install ${ModuleName}: $($_.Exception.Message)"
}
} else
{
Write-Warning "Skipping installation of ${ModuleName}."
}
}
}
# --- 3. Module Imports ---
Install-ModuleIfMissing -ModuleName Terminal-Icons
Install-ModuleIfMissing -ModuleName PSReadLine
Import-Module -Name Terminal-Icons -ErrorAction SilentlyContinue
Import-Module -Name PSReadLine -ErrorAction SilentlyContinue
# --- 4. PSReadLine Configuration (merged & improved) ---
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -PredictionSource HistoryAndPlugin # IntelliSense from history & plugins
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -ShowToolTips
Set-PSReadLineOption -Colors @{
InlinePrediction = '#7f7f7f'
ListPrediction = '#5599dd'
}
# --- Tab / Shift+Tab: full menu completion (restored) ---
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineKeyHandler -Key Shift+Tab -Function TabCompletePrevious
# ---------- ALL YOUR EXISTING PSREADLINE KEY HANDLERS (unchanged) ----------
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineKeyHandler -Key F7 -BriefDescription History -LongDescription 'Show command history' -ScriptBlock {
$pattern = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$pattern, [ref]$null)
if ($pattern)
{ $pattern = [regex]::Escape($pattern)
}
$history = [System.Collections.ArrayList]@()
$last = ''
$lines = ''
foreach ($line in [System.IO.File]::ReadLines((Get-PSReadLineOption).HistorySavePath))
{
if ($line.EndsWith('`'))
{
$line = $line.Substring(0, $line.Length - 1)
$lines = if ($lines)
{ "$lines`n$line"
} else
{ $line
}
continue
}
if ($lines)
{
$line = "$lines`n$line"
$lines = ''
}
if (($line -cne $last) -and (!$pattern -or ($line -match $pattern)))
{
$last = $line
$line
}
}
$history.Reverse()
$command = $history | Out-GridView -Title History -PassThru
if ($command)
{
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert(($command -join "`n"))
}
}
Set-PSReadLineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen
Set-PSReadLineKeyHandler -Key Alt+d -Function ShellKillWord
Set-PSReadLineKeyHandler -Key Alt+Backspace -Function ShellBackwardKillWord
Set-PSReadLineKeyHandler -Key Alt+b -Function ShellBackwardWord
Set-PSReadLineKeyHandler -Key Alt+f -Function ShellForwardWord
Set-PSReadLineKeyHandler -Key Alt+B -Function SelectShellBackwardWord
Set-PSReadLineKeyHandler -Key Alt+F -Function SelectShellForwardWord
# Smart quotes (unchanged)
Set-PSReadLineKeyHandler -Key '"',"'" -BriefDescription SmartInsertQuote -LongDescription "Insert paired quotes" -ScriptBlock {
param($key, $arg)
$quote = $key.KeyChar
$selectionStart = $null; $selectionLength = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetSelectionState([ref]$selectionStart, [ref]$selectionLength)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($selectionStart -ne -1)
{
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($selectionStart, $selectionLength, $quote + $line.SubString($selectionStart, $selectionLength) + $quote)
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($selectionStart + $selectionLength + 2)
return
}
# Simple approach: just insert quotes normally
# Count existing quotes to determine if we're inside a quoted string
$beforeCursor = $line.Substring(0, $cursor)
$quoteCount = ($beforeCursor.ToCharArray() | Where-Object { $_ -eq $quote }).Count
if ($quoteCount % 2 -eq 0) # Even number means we're outside quotes
{
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("$quote$quote")
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($cursor + 1)
} else # Odd number means we're inside quotes
{
[Microsoft.PowerShell.PSConsoleReadLine]::Insert($quote)
}
}
Set-PSReadLineKeyHandler -Key '(','{','[' -BriefDescription InsertPairedBraces -LongDescription "Insert matching braces" -ScriptBlock {
param($key, $arg)
$closeChar = switch ($key.KeyChar)
{
'('
{ [char]')'
} '{'
{ [char]'}'
} '['
{ [char]']'
}
}
$selectionStart = $null; $selectionLength = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetSelectionState([ref]$selectionStart, [ref]$selectionLength)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($selectionStart -ne -1)
{
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($selectionStart, $selectionLength, $key.KeyChar + $line.SubString($selectionStart, $selectionLength) + $closeChar)
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($selectionStart + $selectionLength + 2)
} else
{
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("$($key.KeyChar)$closeChar")
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($cursor + 1)
}
}
Set-PSReadLineKeyHandler -Key ')',']','}' -BriefDescription SmartCloseBraces -LongDescription "Insert closing brace or skip" -ScriptBlock {
param($key, $arg)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($line[$cursor] -eq $key.KeyChar)
{
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($cursor + 1)
} else
{
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("$($key.KeyChar)")
}
}
Set-PSReadLineKeyHandler -Key Backspace -BriefDescription SmartBackspace -LongDescription "Delete previous character or matching quotes/parens/braces" -ScriptBlock {
param($key, $arg)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($cursor -gt 0)
{
$toMatch = $null
if ($cursor -lt $line.Length)
{
switch ($line[$cursor])
{
'"'
{ $toMatch = '"'; break
}
"'"
{ $toMatch = "'"; break
}
')'
{ $toMatch = '('; break
}
']'
{ $toMatch = '['; break
}
'}'
{ $toMatch = '{'; break
}
}
}
if ($toMatch -ne $null -and $line[$cursor-1] -eq $toMatch)
{
[Microsoft.PowerShell.PSConsoleReadLine]::Delete($cursor - 1, 2)
} else
{
[Microsoft.PowerShell.PSConsoleReadLine]::BackwardDeleteChar($key, $arg)
}
}
}
Set-PSReadLineKeyHandler -Key Alt+w -BriefDescription SaveInHistory -LongDescription "Save current line in history but do not execute" -ScriptBlock {
param($key, $arg)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($line)
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
}
Set-PSReadLineKeyHandler -Key Ctrl+V -BriefDescription PasteAsHereString -LongDescription "Paste the clipboard as a here string" -ScriptBlock {
param($key, $arg)
Add-Type -Assembly PresentationCore
if ([System.Windows.Clipboard]::ContainsText())
{
$text = ([System.Windows.Clipboard]::GetText() -replace "\p{Zs}*`r?`n","`n").TrimEnd()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("@'`n$text`n'@")
} else
{
[Microsoft.PowerShell.PSConsoleReadLine]::Ding()
}
}
Set-PSReadLineKeyHandler -Key 'Alt+(' -BriefDescription ParenthesizeSelection -LongDescription "Put parenthesis around the selection or entire line" -ScriptBlock {
param($key, $arg)
$selectionStart = $null; $selectionLength = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetSelectionState([ref]$selectionStart, [ref]$selectionLength)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($selectionStart -ne -1)
{
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($selectionStart, $selectionLength, '(' + $line.SubString($selectionStart, $selectionLength) + ')')
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($selectionStart + $selectionLength + 2)
} else
{
[Microsoft.PowerShell.PSConsoleReadLine]::Replace(0, $line.Length, '(' + $line + ')')
[Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine()
}
}
Set-PSReadLineKeyHandler -Key "Alt+'" -BriefDescription ToggleQuoteArgument -LongDescription "Toggle quotes on the argument under the cursor" -ScriptBlock {
param($key, $arg)
$ast = $null; $tokens = $null; $errors = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$ast, [ref]$tokens, [ref]$errors, [ref]$cursor)
$tokenToChange = $null
foreach ($token in $tokens)
{
$extent = $token.Extent
if ($extent.StartOffset -le $cursor -and $extent.EndOffset -ge $cursor)
{
$tokenToChange = $token
if ($extent.EndOffset -eq $cursor -and $foreach.MoveNext())
{
$nextToken = $foreach.Current
if ($nextToken.Extent.StartOffset -eq $cursor)
{ $tokenToChange = $nextToken
}
}
break
}
}
if ($tokenToChange -ne $null)
{
$extent = $tokenToChange.Extent
$tokenText = $extent.Text
if ($tokenText[0] -eq '"' -and $tokenText[-1] -eq '"')
{ $replacement = $tokenText.Substring(1, $tokenText.Length - 2)
} elseif ($tokenText[0] -eq "'" -and $tokenText[-1] -eq "'")
{ $replacement = '"' + $tokenText.Substring(1, $tokenText.Length - 2) + '"'
} else
{ $replacement = "'" + $tokenText + "'"
}
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($extent.StartOffset, $tokenText.Length, $replacement)
}
}
Set-PSReadLineKeyHandler -Key "Alt+%" -BriefDescription ExpandAliases -LongDescription "Replace all aliases with the full command" -ScriptBlock {
param($key, $arg)
$ast = $null; $tokens = $null; $errors = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$ast, [ref]$tokens, [ref]$errors, [ref]$cursor)
$startAdjustment = 0
foreach ($token in $tokens)
{
if ($token.TokenFlags -band [TokenFlags]::CommandName)
{
$alias = $ExecutionContext.InvokeCommand.GetCommand($token.Extent.Text, 'Alias')
if ($alias -ne $null)
{
$resolvedCommand = $alias.ResolvedCommandName
if ($resolvedCommand -ne $null)
{
$extent = $token.Extent
$length = $extent.EndOffset - $extent.StartOffset
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($extent.StartOffset + $startAdjustment, $length, $resolvedCommand)
$startAdjustment += ($resolvedCommand.Length - $length)
}
}
}
}
}
Set-PSReadLineKeyHandler -Key F1 -BriefDescription CommandHelp -LongDescription "Open the help window for the current command" -ScriptBlock {
param($key, $arg)
$ast = $null; $tokens = $null; $errors = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$ast, [ref]$tokens, [ref]$errors, [ref]$cursor)
$commandAst = $ast.FindAll({ $args[0] -is [CommandAst] -and $args[0].Extent.StartOffset -le $cursor -and $args[0].Extent.EndOffset -ge $cursor }, $true) | Select-Object -Last 1
if ($commandAst -ne $null)
{
$commandName = $commandAst.GetCommandName()
if ($commandName -ne $null)
{
$command = $ExecutionContext.InvokeCommand.GetCommand($commandName, 'All')
if ($command -is [AliasInfo])
{ $commandName = $command.ResolvedCommandName
}
if ($commandName -ne $null)
{ Get-Help $commandName -ShowWindow
}
}
}
}
$global:PSReadLineMarks = @{}
Set-PSReadLineKeyHandler -Key Ctrl+J -BriefDescription MarkDirectory -LongDescription "Mark the current directory" -ScriptBlock {
param($key, $arg)
$key = [Console]::ReadKey($true)
$global:PSReadLineMarks[$key.KeyChar] = $pwd
}
Set-PSReadLineKeyHandler -Key Ctrl+j -BriefDescription JumpDirectory -LongDescription "Goto the marked directory" -ScriptBlock {
param($key, $arg)
$key = [Console]::ReadKey()
$dir = $global:PSReadLineMarks[$key.KeyChar]
if ($dir)
# cd to ct
{ ct $dir; [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
}
}
Set-PSReadLineKeyHandler -Key Alt+j -BriefDescription ShowDirectoryMarks -LongDescription "Show marked directories" -ScriptBlock {
param($key, $arg)
# %
$global:PSReadLineMarks.GetEnumerator() | / { [PSCustomObject]@{Key = $_.Key; Dir = $_.Value} } | Format-Table -AutoSize | Out-Host
[Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
}
Set-PSReadLineOption -CommandValidationHandler {
param([CommandAst]$CommandAst)
switch ($CommandAst.GetCommandName())
{
'git'
{
$gitCmd = $CommandAst.CommandElements[1].Extent
if ($gitCmd.Text -eq 'cmt')
{
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($gitCmd.StartOffset, $gitCmd.EndOffset - $gitCmd.StartOffset, 'commit')
}
}
}
}
Set-PSReadLineKeyHandler -Key RightArrow -BriefDescription ForwardCharAndAcceptNextSuggestionWord -ScriptBlock {
param($key, $arg)
$line = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($cursor -lt $line.Length)
{
[Microsoft.PowerShell.PSConsoleReadLine]::ForwardChar($key, $arg)
} else
{
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptNextSuggestionWord($key, $arg)
}
}
Set-PSReadLineKeyHandler -Key Alt+a -BriefDescription SelectCommandArguments -LongDescription "Select next command argument" -ScriptBlock {
param($key, $arg)
$ast = $null; $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$ast, [ref]$null, [ref]$null, [ref]$cursor)
$asts = $ast.FindAll({ $args[0] -is [ExpressionAst] -and $args[0].Parent -is [CommandAst] -and $args[0].Extent.StartOffset -ne $args[0].Parent.Extent.StartOffset }, $true)
if ($asts.Count -eq 0)
{ [Microsoft.PowerShell.PSConsoleReadLine]::Ding(); return
}
$nextAst = if ($null -ne $arg)
{ $asts[$arg - 1]
} else
{
$result = $null
foreach ($a in $asts)
{ if ($a.Extent.StartOffset -ge $cursor)
{ $result = $a; break
}
}
if ($null -eq $result)
{ $asts[0]
} else
{ $result
}
}
$startOffsetAdjustment = 0; $endOffsetAdjustment = 0
if ($nextAst -is [StringConstantExpressionAst] -and $nextAst.StringConstantType -ne [StringConstantType]::BareWord)
{
$startOffsetAdjustment = 1; $endOffsetAdjustment = 2
}
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($nextAst.Extent.StartOffset + $startOffsetAdjustment)
[Microsoft.PowerShell.PSConsoleReadLine]::SetMark($null, $null)
[Microsoft.PowerShell.PSConsoleReadLine]::SelectForwardChar($null, ($nextAst.Extent.EndOffset - $nextAst.Extent.StartOffset) - $endOffsetAdjustment)
}
Set-PSReadLineKeyHandler -Key Ctrl+Shift+b -BriefDescription BuildCurrentDirectory -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet build")
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}
Set-PSReadLineKeyHandler -Key Ctrl+Shift+t -BriefDescription TestCurrentDirectory -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet test")
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}
# --- 5. Oh-My-Posh (your original theme) ---
$themePaths = @(
"C:\Users\sensei\Documents\zash.omp.json",
"C:\Users\sensei\zash.omp.json"
)
$themePath = $themePaths | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($themePath)
{
oh-my-posh init pwsh --config $themePath | Invoke-Expression
} else
{
Write-Warning "Theme not found, using default"
oh-my-posh init pwsh | Invoke-Expression
}
# --- 6. Linux Aliases & Functions (merged from your original profile) ---
Remove-Item Alias:\cp -Force -ErrorAction SilentlyContinue
Remove-Item Alias:\mv -Force -ErrorAction SilentlyContinue
function ll
{ Get-ChildItem -Force | Format-List
}
function mkdir
{ foreach ($p in $args)
{ New-Item -Path $p -ItemType Directory -Force | Out-Null
}
}
function touch
{ param([Parameter(ValueFromRemainingArguments)][string[]]$Paths) foreach ($p in $Paths)
{ New-Item -ItemType File -Path $p -Force | Out-Null
}
}
Set-Alias ls Get-ChildItem
Set-Alias cat Get-Content
Set-Alias cp Copy-Item -Force
Set-Alias mv Move-Item -Force
Set-Alias rm Remove-Item
Set-Alias pwd Get-Location
Set-Alias man Get-Help
Set-Alias grep Select-String
Set-Alias c Clear-Host
Set-Alias top Get-Process
Set-Alias kill Stop-Process
Set-Alias pn pnpm
Set-Alias touch touch
# --- 7. Enhanced Utility Functions ---
function Edit-Profile
{ zed $PROFILE
}
Set-Alias pro Edit-Profile
function Reload-PowerShellProfile
{ . $PROFILE; Write-Host "Profile reloaded" -ForegroundColor Green
}
Set-Alias rlp Reload-PowerShellProfile
function Set-Env($Name, $Value)
{ Set-Item -Path "env:$Name" -Value $Value; Write-Host "✔ $Name = '$Value'" -ForegroundColor Green
}
Set-Alias se Set-Env
function Clear-Env($Name)
{ if (Test-Path "env:$Name")
{ Remove-Item "env:$Name"; Write-Host "❌ Removed $Name"
} else
{ Write-Warning "$Name does not exist."
}
}
Set-Alias ce Clear-Env
function which($name)
{ (Get-Command $name -ErrorAction SilentlyContinue).Source
}
function uptime
{
$os = Get-CimInstance Win32_OperatingSystem
$uptime = (Get-Date) - $os.LastBootUpTime
"$($uptime.Days)d $($uptime.Hours)h $($uptime.Minutes)m"
}
function sysinfo
{
$computer = Get-CimInstance Win32_ComputerSystem
$os = Get-CimInstance Win32_OperatingSystem
$cpu = Get-CimInstance Win32_Processor | Select-Object -First 1
$gpu = Get-CimInstance Win32_VideoController | Select-Object -First 1
[PSCustomObject]@{
Hostname = $computer.Name
OS = $os.Caption
Uptime = ((Get-Date) - $os.LastBootUpTime).ToString('dd\.hh\:mm')
CPU = $cpu.Name
GPU = $gpu.Name
RAM = "{0:N2} GB" -f ($computer.TotalPhysicalMemory / 1GB)
}
}
function diskusage
{ Get-PSDrive -PSProvider FileSystem | Format-Table Name, @{n='Used(GB)';e={[math]::Round($_.Used/1GB,2)}}, @{n='Free(GB)';e={[math]::Round($_.Free/1GB,2)}}, @{n='Total(GB)';e={[math]::Round(($_.Used+$_.Free)/1GB,2)}}
}
function trash
{ param([Parameter(ValueFromRemainingArguments)][string[]]$Paths) Add-Type -AssemblyName Microsoft.VisualBasic; foreach ($p in $Paths)
{ [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile($p, 'OnlyErrorDialogs', 'SendToRecycleBin')
}
}
Set-Alias del trash -Option AllScope
function psgrep($pattern)
{ Get-Process | Where-Object { $_.Name -match $pattern } | Format-Table Id, Name, CPU, WorkingSet64 -AutoSize
}
# --- 8. Native Completions (keep your original) ---
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
$Local:word = $wordToComplete.Replace('"', '""')
$Local:ast = $commandAst.ToString().Replace('"', '""')
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# Additional completers for git, npm
Register-ArgumentCompleter -Native -CommandName git -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
git --list-cmds=all 2>$null | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
Register-ArgumentCompleter -Native -CommandName npm, npx -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
@('install','run','test','build','start','stop','publish','audit','cache','config','help','init','link','list','login','logout','outdated','owner','pack','prefix','prune','rebuild','repo','restart','root','search','shrinkwrap','star','stars','start','stop','team','test','token','uninstall','unpublish','update','version','view','whoami') |
Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# Env variable completion for Set-Env/Clear-Env
Register-ArgumentCompleter -CommandName Set-Env, Clear-Env -ParameterName Name -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
Get-ChildItem env:* | Where-Object Name -like "$wordToComplete*" | ForEach-Object { $_.Name }
}
# --- 9.1 grep & head & tail
function grep
{
[CmdletBinding()]
param(
[Parameter(Position=0)]
[string]$Pattern,
[Parameter(Position=1, ValueFromRemainingArguments)]
[string[]]$Files,
[switch]$Recurse,
[switch]$CaseSensitive,
[switch]$LineNumber,
[switch]$ListOnly, # like -l: print only file names
[switch]$InvertMatch, # like -v: select non-matching lines
[switch]$Count, # like -c: count matches
[ValidateRange(0, 10)]
[int]$Context = 0 # lines of context
)
# Default: case-insensitive (like GNU grep)
$selectParams = @{
Pattern = $Pattern
CaseSensitive = $CaseSensitive
}
if ($Files.Count -gt 0)
{
$selectParams.Path = $Files
} else
{
# Read from pipeline if no files
$input | Select-String @selectParams | ForEach-Object {
# Format: filename:linenum:text (if piped, no filename)
if ($LineNumber)
{ "$($_.LineNumber):$($_.Line)"
} else
{ $_.Line
}
}
return
}
if ($Recurse)
{
$selectParams.Path = if ($Files.Count -gt 0)
{ $Files
} else
{ "."
}
# For recursion, we need to add -Recurse to Get-ChildItem later; we'll do it separately
$filesToSearch = Get-ChildItem -Recurse -File -Path $selectParams.Path
$selectParams.Path = $filesToSearch.FullName
}
if ($ListOnly)
{
$selectParams.List = $true
}
$results = Select-String @selectParams
if ($Count)
{
$results | Group-Object -Property Filename | ForEach-Object {
"$($_.Name):$($_.Count)"
}
} elseif ($InvertMatch)
{
# For invert match, we need to output non-matching lines
# This is more complex; for brevity we'll just note that full emulation is possible
Write-Warning "InvertMatch (-v) with file scanning not fully implemented; use native Select-String -NotMatch directly."
} else
{
foreach ($match in $results)
{
$line = $match.Line
if ($match.Filename)
{
$prefix = if ($LineNumber)
{ "$($match.Filename):$($match.LineNumber):"
} else
{ "$($match.Filename):"
}
"$prefix$line"
} else
{
$line
}
}
}
}
# --- head && tail
function head
{
param(
[Parameter(ValueFromPipeline)]
[object]$InputObject,
[Parameter(Position=0, Mandatory=$true)]
[int]$Count,
[Parameter(Position=1, ValueFromRemainingArguments)]
[string[]]$Path
)
begin
{
if ($Count -eq 0)
{ $Count = 10
} # Default to 10 if not provided
$lines = @()
}
process
{
if ($Path.Count -gt 0)
{
# File mode
foreach ($file in $Path)
{
Get-Content -Path $file -TotalCount $Count
}
} else
{
# Pipeline mode
$lines += $InputObject
if ($lines.Count -ge $Count)
{
$lines[0..($Count-1)]
$lines = @()
}
}
}
end
{
if ($Path.Count -eq 0 -and $lines.Count -gt 0)
{
$lines[0..([math]::Min($Count-1, $lines.Count-1))]
}
}
}
function tail
{
param(
[Parameter(Position=0, Mandatory=$true)]
[int]$Count,
[Parameter(Position=1, ValueFromRemainingArguments)]
[string[]]$Path
)
begin
{
if ($Count -eq 0)
{ $Count = 10
} # Default to 10 if not provided
}
process
{
foreach ($file in $Path)
{
Get-Content -Path $file -Tail $Count
}
}
}
# --- 9. PSFzf & Zoxide (if installed, auto‑activate) ---
if (Get-Command fzf -ErrorAction SilentlyContinue)
{
if (Get-Module -ListAvailable -Name PSFzf)
{
Import-Module PSFzf
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
} else
{
Write-Warning "PSFzf module not installed. Run: Install-Module -Name PSFzf -Scope CurrentUser"
}
}
if (Get-Command zoxide -ErrorAction SilentlyContinue)
{
Invoke-Expression (zoxide init powershell | Out-String)
}
# --- 10. Startup ---
ipconfig /flushdns | Out-Null
Write-Host "🐚 PowerShell $($PSVersionTable.PSVersion) | $(Get-Date -Format 'yyyy-MM-dd HH:mm') | $(Get-Location)" -ForegroundColor Cyan
# Write-Host "✅ Enhanced profile loaded. Type 'sysinfo' or 'help' to start." -ForegroundColor DarkGray
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "#FF0000",
"style": "plain",
"template": "@{{ .UserName }} ",
"type": "session"
},
{
"foreground": "#62ED8B",
"style": "plain",
"template": "➜",
"type": "text"
},
{
"foreground": "#56B6C2",
"properties": {
"style": "folder"
},
"style": "plain",
"template": " {{ .Path }}",
"type": "path"
},
{
"foreground": "#D4AAFC",
"properties": {
"branch_icon": ""
},
"style": "plain",
"template": " <#DDB15F>git(</>{{ .HEAD }}<#DDB15F>)</>",
"type": "git"
},
{
"foreground": "#DCB977",
"style": "plain",
"template": " ",
"type": "status"
}
],
"type": "prompt"
},
{
"alignment": "right",
"segments": [
{
"foreground": "#FFFFFF",
"style": "powerline",
"template": "Time:{{ .FormattedMs }}",
"type": "executiontime",
"properties": {
"threshold": 10
}
}
],
"type": "rprompt"
}
],
"final_space": true,
"version": 3
}
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
"id": "User.copy.644BA8F2"
},
{
"command": "paste",
"id": "User.paste"
},
{
"command": "find",
"id": "User.find"
},
{
"command":
{
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"id": "User.splitPane.A6751878"
}
],
"copyFormatting": "none",
"copyOnSelect": false,
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"keybindings":
[
{
"id": "User.copy.644BA8F2",
"keys": "ctrl+c"
},
{
"id": "User.paste",
"keys": "ctrl+v"
},
{
"id": "User.find",
"keys": "ctrl+shift+f"
},
{
"id": "User.splitPane.A6751878",
"keys": "alt+shift+d"
}
],
"newTabMenu":
[
{
"type": "remainingProfiles"
}
],
"profiles":
{
"defaults":
{
"colorScheme": "CGA",
"cursorShape": "underscore",
"elevate": true,
"font":
{
"face": "FiraCode Nerd Font"
},
"opacity": 100,
"padding": "10",
"useAcrylic": false
},
"list":
[
{
"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "Windows PowerShell"
},
{
"commandline": "%SystemRoot%\\System32\\cmd.exe",
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"hidden": false,
"name": "Command Prompt"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}",
"hidden": false,
"name": "Git Bash",
"source": "Git"
},
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell",
"source": "Windows.Terminal.PowershellCore"
},
{
"guid": "{38e143d4-5a31-5726-af0e-31a459f8413c}",
"hidden": false,
"name": "Developer Command Prompt for VS 2022",
"source": "Windows.Terminal.VisualStudio"
},
{
"guid": "{39eaf711-fff3-573a-acb7-3d4559507f72}",
"hidden": false,
"name": "Developer PowerShell for VS 2022",
"source": "Windows.Terminal.VisualStudio"
}
]
},
"rendering.graphicsAPI": "direct3d11",
"schemes": [],
"theme": "Example",
"themes":
[
{
"name": "Example",
"tab":
{
"background": "terminalBackground",
"iconStyle": "default",
"showCloseButton": "always",
"unfocusedBackground": "#FFFFFF00"
},
"tabRow":
{
"background": "terminalBackground",
"unfocusedBackground": "terminalBackground"
},
"window":
{
"applicationTheme": "dark",
"experimental.rainbowFrame": false,
"frame": null,
"unfocusedFrame": null,
"useMica": false
}
}
]
}
{
"agent": {
"default_model": {
"provider": "google",
"model": "gemini-2.5-flash"
},
"model_parameters": []
},
"buffer_font_size": 17.0,
"autosave": {
"after_delay": {
"milliseconds": 1000
}
},
"features": {
"edit_prediction_provider": "none"
},
"title_bar": {
"show_branch_icon": false
},
"prettier": {
"allowed": true
},
"buffer_font_family": "FiraCode Nerd Font",
"icon_theme": "Material Icon Theme",
"theme": "v0-dark",
"auto_indent": true,
"auto_update": true,
"base_keymap": "VSCode",
"diagnostics_max_severity": "all",
"edit_predictions": {
"disabled_globs": [
"**/.env*",
"**/*.pem",
"**/*.key",
"**/*.cert",
"**/*.crt",
"**/.dev.vars",
"**/secrets.yml"
]
},
"hide_mouse": "on_typing",
"scrollbar": {
"show": "system"
},
"tab_bar": {
"show": true,
"show_nav_history_buttons": true,
"show_tab_bar_buttons": true
},
"enable_language_server": true,
"ensure_final_newline_on_save": true,
"format_on_save": "on",
"formatter": "language_server",
"global_lsp_settings": {
"button": true
},
"use_autoclose": true,
"diagnostics": {
"include_warnings": true,
"inline": {
"enabled": true
}
},
"go_to_definition_fallback": "find_all_references",
"indent_guides": {
"enabled": true
},
"ui_font_features": {
"calt": true
}
}