Files
ps-profile/profile.ps1
T

48 lines
3.0 KiB
PowerShell

# profile.ps1 — Профиль PS7 gper
# Версия: 1.0.0
# Дата: 2026-07-21
# Подключается через $PROFILE: . "$HOME\Documents\PowerShell\gper-profile\profile.ps1"
# ── Terminal-Icons ───────────────────────────────────────────────────────
Import-Module Terminal-Icons -ErrorAction SilentlyContinue
# ── PSReadLine ───────────────────────────────────────────────────────────
if (Get-Module PSReadLine -ListAvailable -ErrorAction SilentlyContinue) {
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit
}
# ── Промпт ───────────────────────────────────────────────────────────────
function prompt {
$loc = $ExecutionContext.SessionState.Path.CurrentLocation
$ver = $PSVersionTable.PSVersion.Major
$host_str = $env:COMPUTERNAME.ToLower()
"`e[32m[PS$ver`e[0m `e[33m$host_str`e[0m `e[36m$loc`e[0m]`n`e[32m>`e[0m "
}
# ── Алиасы ───────────────────────────────────────────────────────────────
Set-Alias -Name g -Value git -Option AllScope -Force
Set-Alias -Name grep -Value Select-String -Option AllScope -Force
Set-Alias -Name np -Value notepad -Option AllScope -Force
# ── Функции навигации ────────────────────────────────────────────────────
function .. { Set-Location .. }
function ... { Set-Location ..\.. }
function l { Get-ChildItem -Force @args }
# ── Модуль gper-core ────────────────────────────────────────────────────
$gperCore = Join-Path $PSScriptRoot 'modules\gper-core.psm1'
if (Test-Path $gperCore) {
Import-Module $gperCore -Force -DisableNameChecking
}
# ── Информация при старте ────────────────────────────────────────────────
Write-Host "PS $($PSVersionTable.PSVersion) | $env:COMPUTERNAME | $(Get-Date -Format 'dd.MM.yyyy HH:mm')" -ForegroundColor DarkGray