Windows Terminal Install and Beautify

introduce

Windows Teminal is a new, fast, efficient and powerful terminal application for Shell users such as command line tools, command prompts, PowerShell, WSL(Linux subsystem), etc. Its main functions include multi-tabs, panes, Unicode/UTF-8 character support, GPU accelerated text rendering engine, and custom themes, styles and configurations.

Github address: https://github.com/microsoft/terminal

Official download address: https://www.microsoft.com/zh-cn/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab

Install Windows Terminal

Open Microsoft Store, search for Windows Teminal, and install it.

Start:

Install the latest version of PowerShell

Widows 10 defaults to Windows PowerShell version 5.X. When you open PowerShell after Win10 V1903 or above, you will be prompted to "try a new cross-platform PowerShell" https://aka.ms/pscore6" To open the prompt web address.

Download address: https://github.com/PowerShell/PowerShell/releases

Select the installation package in PowerShell-<version>-win-<os-arch>.msi format:

After downloading, double-click the installer and follow the instructions.

Setup creates a shortcut in the Windows Start menu.

  • By default, the package installation location is $env:ProgramFiles\PowerShell\
  • You can use the Start menu or $Env:ProgramFiles\PowerShell\Pwsh.exeStart PowerShell

PowerShell 7 is installed in the new directory and runs in parallel with Windows PowerShell 5.1.For PowerShell Core 6.x, PowerShell 7 is an in-place upgrade that removes PowerShell Core 6.x.

  • PowerShell 7 is installed to $env:ProgramFiles\PowerShell
  • $env:ProgramFiles\PowerShell folder added to $env:PATH
  • $env:ProgramFiles\PowerShell Folder Deleted

If you need to run PowerShell 6 in parallel with PowerShell 7, use ZIP Installation Method Reinstall PowerShell 6.

View versions and enter commands in command line windows

$PSVersionTable.PSVersion

Beautify Windows Terminal

Reference resources: https://docs.microsoft.com/zh-cn/windows/terminal/

The default session is Power Shell version 5.x, modified to 7

"defaultProfile": Change the value to "source": "Windows.Terminal.PowershellCore"A guid is fine, for example if its guid is"{574e775e-4f2a-5b96-ac1e-a2962a402336}".

"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

schemes configuration

		{
				"name": "Snazzy",
				"black": "#000000",
				"red": "#fc4346",
				"green": "#50fb7c",
				"yellow": "#f0fb8c",
				"blue": "#49baff",
				"purple": "#fc4cb4",
				"cyan": "#8be9fe",
				"white": "#ededec",
				"brightBlack": "#555555",
				"brightRed": "#fc4346",
				"brightGreen": "#50fb7c",
				"brightYellow": "#f0fb8c",
				"brightBlue": "#49baff",
				"brightPurple": "#fc4cb4",
				"brightCyan": "#8be9fe",
				"brightWhite": "#ededec",
				"background": "#1e1f29",
				"foreground": "#ebece6"
		}

Install oh-my-posh

Github address: https://github.com/JanDeDobbeleer/oh-my-posh

Install posh-git and oh-my-posh

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Install-Module DirColors

Setting Powershell's profile

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE

Paste the following into the profile file

Import-Module posh-git
Import-Module oh-my-posh
Import-Module DirColors

Theme Color Beautification

Install colortool

scoop install colortool

View color scheme

colortool -s

Set color:

colortool OneHalfDark.itermcolors

Power Shell 7 Beautification

Configuration for Power Shell 7:

            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "colorScheme" : "Snazzy",
                "startingDirectory": "E:\\",
				"fontFace" : "Cascadia Code PL",
                "cursorColor" : "#000000"
            }

The display effect is as follows:

ubuntu beautification

Configuration for Power Shell 7:

            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "name": "Ubuntu-20.04",
				"colorScheme" : "Snazzy",
                "startingDirectory": "E:\\code",
                "source": "Windows.Terminal.Wsl"
            },

Modify the command prompt to modify the root user's ~/.bashrc file:

export PS1='\[\e[31;1m\][\u\[\e[37;1m\]@\[\e[34;1m\]\H \W]\[\e[35;1m\]\$ \[\e[0m\]'

New/etc/profile.d/ps1.sh

export PS1='\[\e[36;1m\][\u\[\e[33;1m\]@\[\e[35;1m\]\H \W]\[\e[34;1m\]\$ \[\e[0m\]'

New/etc/profile.d/alias.sh

alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'
alias xzegrep='xzegrep --color=auto'
alias xzfgrep='xzfgrep --color=auto'
alias xzgrep='xzgrep --color=auto'
alias zegrep='zegrep --color=auto'
alias zfgrep='zfgrep --color=auto'
alias zgrep='zgrep --color=auto'

The display effect is as follows:

Tags: Windows shell github git

Posted on Fri, 22 May 2020 12:52:06 -0400 by arbelo