- Руководство: настройка Powerline в Терминале Windows Tutorial: Set up Powerline in Windows Terminal
- Предварительные условия Prerequisites
- Установка шрифта Powerline Install a Powerline font
- Настройка Powerline в PowerShell Set up Powerline in PowerShell
- Предварительные требования для PowerShell PowerShell prerequisites
- Настройка командной строки PowerShell Customize your PowerShell prompt
- Задание шрифта Set Cascadia Code PL для параметра fontFace Set Cascadia Code PL as fontFace in settings
- Настройка Powerline в WSL Ubuntu Set up Powerline in WSL Ubuntu
- Предварительные требования WSL Ubuntu WSL Ubuntu prerequisites
- Настройка командной строки Ubuntu Customize your Ubuntu prompt
- Advanced profile settings in Windows Terminal
- Suppress title changes
- Text antialiasing
- AltGr aliasing
- Scroll to input when typing
- History size
- Profile termination behavior
- Bell notification style
- Unique identifier
- Source
- Appearance profile settings in Windows Terminal
- Color scheme
- Font face
- Font size
- Font weight
- Retro terminal effects
- Cursor
- Cursor shape
- Cursor height
- Background image
- Background image path
- Background image stretch mode
- Background image alignment
- Background image opacity
- Acrylic
- Enable acrylic
- Acrylic opacity
- Window
- Padding
- Scrollbar visibility
- Color settings
- Tab color
- Foreground color
- Background color
- Selection background color
- Cursor color
- Unfocused appearance settings
- Unfocused appearance settings (Preview)
- Pixel shader effects
Руководство: настройка Powerline в Терминале Windows Tutorial: Set up Powerline in Windows Terminal
Powerline обеспечивает настраиваемый интерфейс командной строки, предоставляя запросы и цветовое кодирование состояния Git. Powerline provides a customized command prompt experience providing Git status color-coding and prompts.
В этом руководстве описано следующее: In this tutorial, you learn how to:
- Настройка Powerline в PowerShell. Set up Powerline in PowerShell
- Настройка Powerline в Ubuntu/WSL. Set up Powerline in Ubuntu/WSL
- Добавление отсутствующих глифов Powerline. Add missing Powerline glyphs
Предварительные условия Prerequisites
Установка шрифта Powerline Install a Powerline font
Для настройки стиля запроса в Powerline используются глифы. Powerline uses glyphs in order to style the prompt. Если шрифт не содержит глифы Powerline, в запросе могут появиться несколько символов замены Юникода ▯. If your font does not include Powerline glyphs, you may see several Unicode replacement characters ‘▯’ throughout your prompt. Так как шрифт Cascadia Mono не содержит глифы Powerline, вы можете установить шрифт Cascadia Code PL или Cascadia Mono PL, в которые включены эти глифы. Though Cascadia Mono does not include Powerline glyphs, you can install Cascadia Code PL or Cascadia Mono PL, which have the Powerline glyphs included. Их можно установить со страницы выпусков Cascadia Code на сайте GitHub. These fonts can be installed from the Cascadia Code GitHub releases page.
Настройка Powerline в PowerShell Set up Powerline in PowerShell
Предварительные требования для PowerShell PowerShell prerequisites
С помощью PowerShell установите модули Posh-Git и Oh-My-Posh: Using PowerShell, install Posh-Git and Oh-My-Posh:
Возможно, вам потребуется установить NuGet (если вы еще не сделали этого). You may need to install NuGet if you don’t already have it. В таком случае в командной строке PowerShell отобразится запрос на установку NuGet. Your PowerShell command line will ask if you want to install NuGet if this is the case. Нажмите клавишу Y (Да). Select [Y] Yes. Вам также может потребоваться утвердить установку модулей из PSGallery, недоверенного репозитория. You may also need to approve that you are installing modules from PSGallery, an ‘untrusted repository’. Нажмите клавишу Y (Да). Select [Y] Yes.
Модуль Posh-Git добавляет в запрос сведения о состоянии Git, а также заполнение нажатием клавиши TAB для команд, параметров, удаленных элементов и имен ветвей Git. Posh-Git adds Git status information to your prompt as well as tab-completion for Git commands, parameters, remotes, and branch names. Модуль Oh-My-Posh предоставляет для командной строки PowerShell возможности темы. Oh-My-Posh provides theme capabilities for your PowerShell prompt.
Если вы используете PowerShell Core, установите модуль PSReadline: If you are using PowerShell Core, install PSReadline:
Модуль PSReadline позволяет настраивать среду редактирования командной строки в PowerShell. PSReadline lets you customize the command line editing environment in PowerShell.
Настройка командной строки PowerShell Customize your PowerShell prompt
Откройте профиль PowerShell с помощью notepad $PROFILE или любого текстового редактора. Open your PowerShell profile with notepad $PROFILE or the text editor of your choice. Это не профиль Терминала Windows. This is not your Windows Terminal profile. Профиль PowerShell является сценарием, который выполняется при каждом запуске PowerShell. Your PowerShell profile is a script that runs every time PowerShell starts. Ознакомьтесь с дополнительными сведениями о профилях PowerShell. Learn more about PowerShell profiles.
В профиле PowerShell добавьте в конец файла следующее: In your PowerShell profile, add the following to the end of the file:
Теперь запуск каждого нового экземпляра начинается с импорта модуля Posh-Git и Oh-My-Posh, а затем установки темы Paradox из Oh-My-Posh. Now, each new instance starts by importing Posh-Git and Oh-My-Posh, then setting the Paradox theme from Oh-My-Posh. Модуль Oh-My-Posh поставляется с несколькими встроенными темами. Oh-My-Posh comes with several built-in themes.
Задание шрифта Set Cascadia Code PL для параметра fontFace Set Cascadia Code PL as fontFace in settings
Чтобы задать шрифт Cascadia Code PL для использования с PowerLine (после скачивания, распаковки и установки в системе), вам потребуется открыть параметры профиля в файле settings.json, выбрав Параметры (CTRL+,) в раскрывающемся меню Терминала Windows. To set the Cascadia Code PL font for use with PowerLine (after downloading, unzipping, and installing on your system), you will need to open your profile settings in your settings.json file by selecting Settings (Ctrl+,) from your Windows Terminal drop-down menu.
Открыв файл settings.json, найдите профиль Windows PowerShell и добавьте «fontFace»: «Cascadia Code PL» , чтобы назначить шрифт Cascadia Code PL. Once your settings.json file opens, find the Windows PowerShell profile and add: «fontFace»: «Cascadia Code PL» to designate Cascadia Code PL as the font. Теперь вам будут доступны красивые глифы Powerline из Cascadia Code. This will provide those nice Cascadia Code Powerline glyphs. Изменения будут применены в терминале, как только вы щелкнете Сохранить в редакторе. You should notice the change in your terminal as soon as you select Save in your editor.
Ваш файл settings.json профиля Windows PowerShell теперь будет выглядеть следующим образом: Your Windows PowerShell profile settings.json file should now look like this:
Настройка Powerline в WSL Ubuntu Set up Powerline in WSL Ubuntu
Предварительные требования WSL Ubuntu WSL Ubuntu prerequisites
В Ubuntu есть несколько параметров Powerline для установки. Ubuntu has several Powerline options to install from. В рамках этого руководства мы будем использовать Go и Powerline-Go: This tutorial will be using Go and Powerline-Go:
Настройка командной строки Ubuntu Customize your Ubuntu prompt
/.bashrc с помощью nano
/.bashrc или любого текстового редактора. Open your
/.bashrc file with nano
/.bashrc or the text editor of your choice. Это скрипт Bash, который выполняется при каждом запуске Bash. This is a bash script that runs every time bash starts. Добавьте следующий фрагмент кода, но обратите внимание, что GOPATH уже может существовать: Add the following, though beware that GOPATH may already exist:
Advanced profile settings in Windows Terminal
The settings listed below are specific to each unique profile. If you’d like a setting to apply to all of your profiles, you can add it to the defaults section above the list of profiles in your settings.json file.
Suppress title changes
When this is set to true , tabTitle overrides the default title of the tab and any title change messages from the application will be suppressed. If tabTitle isn’t set, name will be used instead. When this is set to false , tabTitle behaves as normal.
Property name: suppressApplicationTitle
Necessity: Optional
Accepts: true , false
Text antialiasing
This controls how text is antialiased in the renderer. Note that changing this setting will require starting a new terminal instance.
Property name: antialiasingMode
Necessity: Optional
Accepts: «grayscale» , «cleartype» , «aliased»
Default value: «grayscale»
AltGr aliasing
This allows you to control if Windows Terminal will treat ctrl+alt as an alias for AltGr .
Property name: altGrAliasing
Necessity: Optional
Accepts: true , false
Default value: true
Scroll to input when typing
When this is set to true , the window will scroll to the command input line when typing. When it’s set to false , the window will not scroll when you start typing.
Property name: snapOnInput
Necessity: Optional
Accepts: true , false
Default value: true
History size
This sets the number of lines above the ones displayed in the window you can scroll back to.
Property name: historySize
Necessity: Optional
Accepts: Integer
Default value: 9001
Profile termination behavior
This sets how the profile reacts to termination or failure to launch. «graceful» will close the profile when exit is typed or when the process exits normally. «always» will always close the profile and «never» will never close the profile. true and false are accepted as synonyms for «graceful» and «never» , respectively.
Property name: closeOnExit
Necessity: Optional
Accepts: «graceful» , «always» , «never» , true , false
Default value: «graceful»
Bell notification style
Controls what happens when the application emits a BEL character. When set to «all» , the terminal will play a sound and flash the taskbar icon.
Property name: bellStyle
Necessity: Optional
Accepts: «all» , «audible» , «visual» , «none»
Default value: «audible»
Unique identifier
Profiles can use a GUID as a unique identifier. To make a profile your default profile, it needs a GUID for the defaultProfile global setting.
Property name: guid
Necessity: Required
Accepts: GUID as a string in registry format: «<00000000-0000-0000-0000-000000000000>«
You can run [guid]::NewGuid() in PowerShell to generate a GUID for your custom profile. You can also use the online GUID generator or for other command lines, use the UUID generator.
Source
This stores the name of the profile generator that originated the profile. There are no discoverable values for this field. For additional information on dynamic profiles, visit the Dynamic profiles page.
Property name: source
Necessity: Optional
Accepts: String
This field should be omitted when declaring a custom profile. It is used by Terminal to connect automatically generated profiles to your settings file.
Appearance profile settings in Windows Terminal
The settings listed below are specific to each unique profile. If you’d like a setting to apply to all of your profiles, you can add it to the defaults section above the list of profiles in your settings.json file.
Color scheme
This is the name of the color scheme used in the profile. Color schemes are defined in the schemes object. More detailed information can be found on the Color schemes page.
Property name: colorScheme
Necessity: Optional
Accepts: Name of color scheme as a string
Default value: «Campbell»
Font face
This is the name of the font face used in the profile. The terminal will try to fallback to Consolas if this can’t be found or is invalid. To learn about the other variants of the default font, Cascadia Mono, visit the Cascadia Code page.
Property name: fontFace
Necessity: Optional
Accepts: Font name as a string
Default value: «Cascadia Mono»
Font size
This sets the profile’s font size in points.
Property name: fontSize
Necessity: Optional
Accepts: Integer
Default value: 12
Font weight
This sets the weight (lightness or heaviness of the strokes) for the profile’s font.
Property name: fontWeight
Necessity: Optional
Accepts: «normal» , «thin» , «extra-light» , «light» , «semi-light» , «medium» , «semi-bold» , «bold» , «extra-bold» , «black» , «extra-black» , or an integer corresponding to the numeric representation of the OpenType font weight
Default value: «normal»
Retro terminal effects
When this is set to true , the terminal will emulate a classic CRT display with scan lines and blurry text edges. This is an experimental feature and its continued existence is not guaranteed.
If experimental.pixelShaderPath is set, it will override this setting.
Property name: experimental.retroTerminalEffect
Necessity: Optional
Accepts: true , false
Default value: false
Configuration: Retro Command Prompt
Cursor
Cursor shape
This sets the cursor shape for the profile. The possible cursors are as follows: «bar» ( в”ѓ ), «vintage» ( в–ѓ ), «underscore» ( в–Ѓ ), «filledBox» ( в–€ ), «emptyBox» ( в–Ї ), «doubleUnderscore» ( ‗ )
Property name: cursorShape
Necessity: Optional
Accepts: «bar» , «vintage» , «underscore» , «filledBox» , «emptyBox» , «doubleUnderscore»
Default value: «bar»
Cursor height
This sets the percentage height of the cursor starting from the bottom. This will only work when cursorShape is set to «vintage» .
Property name: cursorHeight
Necessity: Optional
Accepts: Integer from 25-100
Background image
Background image path
This sets the file location of the image to draw over the window background. The background image can be a .jpg, .png, or .gif file. «desktopWallpaper» will set the background image to the desktop’s wallpaper.
Property name: backgroundImage
Necessity: Optional
Accepts: File location as a string or «desktopWallpaper»
Background image stretch mode
This sets how the background image is resized to fill the window.
Property name: backgroundImageStretchMode
Necessity: Optional
Accepts: «none» , «fill» , «uniform» , «uniformToFill»
Default value: «uniformToFill»
Background image source
Background image alignment
This sets how the background image aligns to the boundaries of the window.
Property name: backgroundImageAlignment
Necessity: Optional
Accepts: «center» , «left» , «top» , «right» , «bottom» , «topLeft» , «topRight» , «bottomLeft» , «bottomRight»
Default value: «center»
Background image source
Background image opacity
This sets the transparency of the background image.
Property name: backgroundImageOpacity
Necessity: Optional
Accepts: Number as a floating point value from 0-1
Default value: 1.0
Acrylic
Enable acrylic
When this is set to true , the window will have an acrylic background. When it’s set to false , the window will have a plain, untextured background. The transparency only applies to focused windows due to OS limitations.
Property name: useAcrylic
Necessity: Optional
Accepts: true , false
Default value: false
Acrylic opacity
When useAcrylic is set to true , this sets the transparency of the window for the profile. This accepts floating point values from 0-1.
Property name: acrylicOpacity
Necessity: Optional
Accepts: Number as a floating point value from 0-1
Default value: 0.5
Window
Padding
This sets the padding around the text within the window. This will accept three different formats: «#» and # set the same padding for all sides, «#, #» sets the same padding for left-right and top-bottom, and «#, #, #, #» sets the padding individually for left, top, right, and bottom.
Property name: padding
Necessity: Optional
Accepts: Values as a string in the following formats: «#» , «#, #» , «#, #, #, #» or value as an integer: #
Default value: «8, 8, 8, 8»
Scrollbar visibility
This sets the visibility of the scrollbar.
Property name: scrollbarState
Necessity: Optional
Accepts: «visible» , «hidden»
Color settings
Tab color
This sets the color of the profile’s tab. Using the tab color picker will override this color.
Property name: tabColor
Necessity: Optional
Accepts: Color as a string in hex format: «#rgb» or «#rrggbb»
Foreground color
This changes the foreground color of the profile. This overrides foreground set in the color scheme if colorScheme is set.
Property name: foreground
Necessity: Optional
Accepts: Color as a string in hex format: «#rgb» or «#rrggbb»
Background color
This changes the background color of the profile with this setting. This overrides background set in the color scheme if colorScheme is set.
Property name: background
Necessity: Optional
Accepts: Color as a string in hex format: «#rgb» or «#rrggbb»
Selection background color
This sets the background color of a selection within the profile. This will override the selectionBackground set in the color scheme if colorScheme is set.
Property name: selectionBackground
Necessity: Optional
Accepts: Color as a string in hex format: «#rgb» or «#rrggbb»
Cursor color
This sets the cursor color of the profile. This will override the cursorColor set in the color scheme if colorScheme is set.
Property name: cursorColor
Necessity: Optional
Accepts: Color as a string in hex format: «#rgb» or «#rrggbb»
Unfocused appearance settings
Unfocused appearance settings (Preview)
An object you can add to a profile that applies settings to the profile when it is unfocused. This setting only accepts appearance settings.
Property name: unfocusedAppearance
Necessity: Optional
Accepts: backgroundImage , backgroundImageAlignment , backgroundImageOpacity , backgroundImageStretchMode , cursorHeight , cursorShape , cursorColor , colorScheme , foreground , background , selectionBackground , experimental.retroTerminalEffect , experimental.pixelShaderPath
Example:
This feature is only available in Windows Terminal Preview.
Pixel shader effects
This setting allows a user to specify the path to a custom pixel shader to use with the terminal content. This is an experimental feature and its continued existence is not guaranteed. For more details on authoring custom pixel shaders for the terminal, see this documentation.
If set, this will override the experimental.retroTerminalEffect setting.
Property name: experimental.pixelShaderPath
Necessity: Optional
Accepts: A path to an .hlsl shader file, as a string