###### tags: `環境メモ` # Powershell on Windows ```posh Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') scoop install aria2 scoop install git scoop install lsd # Forceオプションは、stable版が既にインストールされている場合に必要 Install-Module PSReadLine -AllowPrerelease -Force Install-Module oh-my-posh -Scope CurrentUser ``` ```posh scoop install 7zip scoop install ffmpeg-nightly scoop install curl curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python poetry config virtualenvs.in-project true ``` (Windows Terminal)`settings.json` ```json "fontFace": "HackGenNerd Console", "backgroundImageOpacity": 0.5, "acrylicOpacity": 0.8, "useAcrylic": true ``` (Powershell 7)`code $profile` ```posh Import-Module oh-my-posh Set-PoshPrompt -Theme Pure Import-Module PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -Colors @{ InlinePrediction = '#606060'} Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward $options = @{ MaximumHistoryCount = 10000 HistoryNoDuplicates = $true HistorySearchCursorMovesToEnd = $true AddToHistoryHandler = { param([string]$line) return $line.Length -gt 3 -and $line[0] -ne ' ' } } Set-PSReadLineOption @options function lsd_all() { lsd.exe -a $args } function lsd_list() { lsd.exe -l $args } function lsd_list_all() { lsd.exe -la $args } function open_with_explorer() { explorer $args } function which_in_posh() { (gcm $args).Definition } Set-Alias ls lsd Set-Alias la lsd_all Set-Alias ll lsd_list Set-Alias lla lsd_list_all Set-Alias which which_in_posh Set-Alias open open_with_explorer ``` ```posh code (Get-PSReadlineOption).HistorySavePath ```