はじめに
本記事は、以下の方向けの記事です。
- Windows 環境である
- Windows Terminal で Git Bash を使っている(※本記事では、Windows Terminal で Git Bash を起動できるようにする部分は扱いません、他記事を参照してください)
- 見た目をかっこよくしたい
この記事を見ると、以下のような見た目に近づきます。
Pureline の設定と、 Windows Terminal のフォント・配色の設定を行います。
pureline の設定(.pureline.conf)
pureline のインストール
GitHub – chris-marsh/pureline: A Pure Bash Powerline PS1 Command Prompt
こちらから、pureline をインストールします。
インストールを参照してください。git clone
でクローンします。
$ git clone https://github.com/chris-marsh/pureline.git
$ cp pureline/configs/powerline_full_256col.conf ~/.pureline.conf
~/.bashrc
に以下を追加します。.pureline.conf
は見え方の設定ファイルのようなイメージです。
source ~/pureline/pureline ~/.pureline.conf
ちなみに、~/.bashrc
については、以下に私が使っている設定を記載しているので、よければ参照してください。
~/.pureline.conf の設定
私のpurelineの設定を以下に示します。
PL_SEGMENTS の部分を変更しています。①何を表示するか?②表示したときに何色にするか?を設定しています。
# Full example config for PureLine using default powerline symbols
# and custom 256 color
# Colors must be defined in pairs of FG & BG
PL_COLORS[MyOrange]='\[\e[38;5;208m\]'
PL_COLORS[On_MyOrange]='\[\e[48;5;208m\]'
PL_COLORS[MyLime]='\[\e[38;5;119m\]'
PL_COLORS[On_MyLime]='\[\e[48;5;119m\]'
PL_COLORS[MyYellow]='\[\e[38;5;227m\]'
PL_COLORS[On_MyYellow]='\[\e[48;5;227m\]'
PL_COLORS[MyLightGrey]='\[\e[38;5;250m\]'
PL_COLORS[On_MyLightGrey]='\[\e[48;5;250m\]'
PL_COLORS[MyBlue]='\[\e[38;5;69m\]'
PL_COLORS[On_MyBlue]='\[\e[48;5;69m\]'
PL_COLORS[MyRed]='\[\e[38;5;196m\]'
PL_COLORS[On_MyRed]='\[\e[48;5;196m\]'
PL_COLORS[MyDarkGrey]='\[\e[38;5;240m\]'
PL_COLORS[On_MyDarkGrey]='\[\e[48;5;240m\]'
PL_COLORS[MyPurple]='\[\e[38;5;89m\]'
PL_COLORS[On_MyPurple]='\[\e[48;5;89m\]'
PL_COLORS[MyGreen]='\[\e[38;5;83m\]'
PL_COLORS[On_MyGreen]='\[\e[48;5;83m\]'
# All segments are enabled. Uncomment/comment to enable/disable a segment
PL_SEGMENTS=(
# segment Background Foreground
# ------- ---------- ----------
# 'time_segment MyLightGrey Black'
'time_segment White Black'
# 'battery_segment MyBlue Black'
# 'user_segment MyLime Black'
'ssh_segment MyYellow Black'
'screen_session_segment MyLightGrey Black'
'virtual_env_segment Blue Black'
# 'conda_env_segment MyBlue Black'
# 'aws_profile_segment MyLime Black'
# 'kubernetes_segment MyLime Black'
'path_segment MyDarkGrey White'
# 'read_only_segment MyRed White'
# 'background_jobs_segment MyPurple White'
'git_segment Green Black'
'return_code_segment MyRed White'
'newline_segment'
# 'duration_segment MyDarkGrey White'
'prompt_segment MyDarkGrey White'
)
# segment Options
PL_PATH_TRIM=0 # 0 Full path, 1, Current, 2+ trim level
PL_TIME_SHOW_SECONDS=false
PL_USER_SHOW_HOST=true
PL_USER_USE_IP=false
PL_SSH_SHOW_HOST=true
PL_SSH_USE_IP=true
PL_GIT_DIRTY_FG=Black
PL_GIT_DIRTY_BG=MyLime
PL_GIT_AHEAD=true
PL_GIT_MODIFIED=true
PL_GIT_STAGED=true
PL_GIT_CONFLICTS=true
PL_GIT_UNTRACKED=true
PL_GIT_STASH=true
PL_PROMPT_ROOT_BG=Red
PL_PROMPT_ROOT_FG=White
# redefine symbols using powerline glyphs
PL_SYMBOLS[hard_separator]=""
PL_SYMBOLS[soft_separator]=""
PL_SYMBOLS[git_branch]=""
PL_SYMBOLS[git_untracked]="↔"
PL_SYMBOLS[git_stash]="§"
PL_SYMBOLS[git_ahead]="↑"
PL_SYMBOLS[git_behind]="↓"
PL_SYMBOLS[git_modified]="✚ "
PL_SYMBOLS[git_staged]="✔ "
PL_SYMBOLS[git_conflicts]="✘ "
PL_SYMBOLS[read_only]=""
PL_SYMBOLS[return_code]="⚑"
PL_SYMBOLS[background_jobs]="⏎"
PL_SYMBOLS[battery_charging]="⚡"
PL_SYMBOLS[battery_discharging]="▮"
PL_SYMBOLS[aws_profile]='☁'
PL_SYMBOLS[screen]='💻'
PL_SYMBOLS[duration]='⏳'
PL_SYMBOLS[pwd_separator]=''
PL_SYMBOLS[pwd_trimmed]=''
Nerd Font のインストール
ターミナルでアイコンが使えるように、アイコンフォントをインストールします。
以下のどちらかから、ダウンロードして、PCにインストールしておきます。
- Nerd Fonts – Iconic font aggregator, glyphs/icons collection, & fonts patcher
- Releases · ryanoasis/nerd-fonts · GitHub (※Githubからの場合、Assets から zip ファイルをダウンロードします。)
Windows Terminal のフォント・配色の設定
まずは、上部のタスクバーで右クリックをして、設定画面を開きます。
その後、JSONファイルを開くを押して、settings.jsonを開きます。
JSONファイルのパスは、以下です。
C:\Users\<user_name>\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
私の設定は以下の通りです。Gruvbox Material 周りの配色は以下から引っ張ってきています。
gruvbox-material-windows-terminal.json · GitHub
ちなみに、フォントは FiraMono Nerd Font を使ってます。
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command":
{
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
},
{
"command": "paste",
"keys": "ctrl+v"
},
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
}
],
"copyFormatting": "none",
"copyOnSelect": false,
"defaultProfile": "{xxxx}",
"newTabMenu":
[
{
"type": "remainingProfiles"
}
],
"profiles":
{
"defaults":
{
"colorScheme": "GruvboxMaterialHardDark",
"cursorShape": "filledBox",
"font":
{
"face": "FiraMono Nerd Font"
},
"opacity": 95,
"useAcrylic": false
},
"list":
[
{
"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"guid": "{xxxx}",
"hidden": false,
"name": "Windows PowerShell"
},
{
"commandline": "%SystemRoot%\\System32\\cmd.exe",
"guid": "{xxxx}",
"hidden": false,
"name": "\u30b3\u30de\u30f3\u30c9 \u30d7\u30ed\u30f3\u30d7\u30c8"
},
{
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
"font":
{
"weight": "normal"
},
"guid": "{xxxx}",
"hidden": false,
"icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
"name": "Git Bash",
"startingDirectory": "%USERPROFILE%"
}
]
},
"schemes":
[
{
"background": "#0C0C0C",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
},
{
"background": "#012456",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell Powershell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
},
{
"background": "#1D2021",
"black": "#665C54",
"blue": "#7DAEA3",
"brightBlack": "#928374",
"brightBlue": "#7DAEA3",
"brightCyan": "#89B482",
"brightGreen": "#A9B665",
"brightPurple": "#D3869B",
"brightRed": "#EA6962",
"brightWhite": "#D4BE98",
"brightYellow": "#D8A657",
"cursorColor": "#FFFFFF",
"cyan": "#89B482",
"foreground": "#D4BE98",
"green": "#A9B665",
"name": "GruvboxMaterialHardDark",
"purple": "#D3869B",
"red": "#EA6962",
"selectionBackground": "#FFFFFF",
"white": "#D4BE98",
"yellow": "#D8A657"
},
{
"background": "#F9F5D7",
"black": "#504945",
"blue": "#45707A",
"brightBlack": "#504945",
"brightBlue": "#45707A",
"brightCyan": "#4C7A5D",
"brightGreen": "#6C782E",
"brightPurple": "#945E80",
"brightRed": "#C14A4A",
"brightWhite": "#D4BE98",
"brightYellow": "#B47109",
"cursorColor": "#FFFFFF",
"cyan": "#4C7A5D",
"foreground": "#654735",
"green": "#6C782E",
"name": "GruvboxMaterialHardLight",
"purple": "#945E80",
"red": "#C14A4A",
"selectionBackground": "#FFFFFF",
"white": "#D4BE98",
"yellow": "#B47109"
},
{
"background": "#282828",
"black": "#665C54",
"blue": "#7DAEA3",
"brightBlack": "#928374",
"brightBlue": "#7DAEA3",
"brightCyan": "#89B482",
"brightGreen": "#A9B665",
"brightPurple": "#D3869B",
"brightRed": "#EA6962",
"brightWhite": "#D4BE98",
"brightYellow": "#D8A657",
"cursorColor": "#FFFFFF",
"cyan": "#89B482",
"foreground": "#D4BE98",
"green": "#A9B665",
"name": "GruvboxMaterialMediumDark",
"purple": "#D3869B",
"red": "#EA6962",
"selectionBackground": "#FFFFFF",
"white": "#D4BE98",
"yellow": "#D8A657"
},
{
"background": "#FBF1C7",
"black": "#504945",
"blue": "#45707A",
"brightBlack": "#504945",
"brightBlue": "#45707A",
"brightCyan": "#4C7A5D",
"brightGreen": "#6C782E",
"brightPurple": "#945E80",
"brightRed": "#C14A4A",
"brightWhite": "#D4BE98",
"brightYellow": "#B47109",
"cursorColor": "#FFFFFF",
"cyan": "#4C7A5D",
"foreground": "#654735",
"green": "#6C782E",
"name": "GruvboxMaterialMediumLight",
"purple": "#945E80",
"red": "#C14A4A",
"selectionBackground": "#FFFFFF",
"white": "#D4BE98",
"yellow": "#B47109"
},
{
"background": "#32302F",
"black": "#665C54",
"blue": "#7DAEA3",
"brightBlack": "#928374",
"brightBlue": "#7DAEA3",
"brightCyan": "#89B482",
"brightGreen": "#A9B665",
"brightPurple": "#D3869B",
"brightRed": "#EA6962",
"brightWhite": "#D4BE98",
"brightYellow": "#D8A657",
"cursorColor": "#FFFFFF",
"cyan": "#89B482",
"foreground": "#D4BE98",
"green": "#A9B665",
"name": "GruvboxMaterialSoftDark",
"purple": "#D3869B",
"red": "#EA6962",
"selectionBackground": "#FFFFFF",
"white": "#D4BE98",
"yellow": "#D8A657"
},
{
"background": "#F2E5BC",
"black": "#504945",
"blue": "#45707A",
"brightBlack": "#504945",
"brightBlue": "#45707A",
"brightCyan": "#4C7A5D",
"brightGreen": "#6C782E",
"brightPurple": "#945E80",
"brightRed": "#C14A4A",
"brightWhite": "#D4BE98",
"brightYellow": "#B47109",
"cursorColor": "#FFFFFF",
"cyan": "#4C7A5D",
"foreground": "#654735",
"green": "#6C782E",
"name": "GruvboxMaterialSoftLight",
"purple": "#945E80",
"red": "#C14A4A",
"selectionBackground": "#FFFFFF",
"white": "#D4BE98",
"yellow": "#B47109"
},
{
"background": "#2E3440",
"black": "#3B4252",
"blue": "#81A1C1",
"brightBlack": "#4C566A",
"brightBlue": "#81A1C1",
"brightCyan": "#8FBCBB",
"brightGreen": "#A3BE8C",
"brightPurple": "#B48EAD",
"brightRed": "#BF616A",
"brightWhite": "#ECEFF4",
"brightYellow": "#EBCB8B",
"cursorColor": "#81A1C1",
"cyan": "#88C0D0",
"foreground": "#D8DEE9",
"green": "#A3BE8C",
"name": "Nord",
"purple": "#B48EAD",
"red": "#BF616A",
"selectionBackground": "#434C5E",
"white": "#E5E9F0",
"yellow": "#EBCB8B"
},
{
"background": "#282C34",
"black": "#282C34",
"blue": "#61AFEF",
"brightBlack": "#5A6374",
"brightBlue": "#61AFEF",
"brightCyan": "#56B6C2",
"brightGreen": "#98C379",
"brightPurple": "#C678DD",
"brightRed": "#E06C75",
"brightWhite": "#DCDFE4",
"brightYellow": "#E5C07B",
"cursorColor": "#FFFFFF",
"cyan": "#56B6C2",
"foreground": "#DCDFE4",
"green": "#98C379",
"name": "One Half Dark",
"purple": "#C678DD",
"red": "#E06C75",
"selectionBackground": "#FFFFFF",
"white": "#DCDFE4",
"yellow": "#E5C07B"
},
{
"background": "#FAFAFA",
"black": "#383A42",
"blue": "#0184BC",
"brightBlack": "#4F525D",
"brightBlue": "#61AFEF",
"brightCyan": "#56B5C1",
"brightGreen": "#98C379",
"brightPurple": "#C577DD",
"brightRed": "#DF6C75",
"brightWhite": "#FFFFFF",
"brightYellow": "#E4C07A",
"cursorColor": "#4F525D",
"cyan": "#0997B3",
"foreground": "#383A42",
"green": "#50A14F",
"name": "One Half Light",
"purple": "#A626A4",
"red": "#E45649",
"selectionBackground": "#FFFFFF",
"white": "#FAFAFA",
"yellow": "#C18301"
},
{
"background": "#002B36",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#FFFFFF",
"cyan": "#2AA198",
"foreground": "#839496",
"green": "#859900",
"name": "Solarized Dark",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
},
{
"background": "#FDF6E3",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#002B36",
"cyan": "#2AA198",
"foreground": "#657B83",
"green": "#859900",
"name": "Solarized Light",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
},
{
"background": "#000000",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#FFFFFF",
"cyan": "#06989A",
"foreground": "#D3D7CF",
"green": "#4E9A06",
"name": "Tango Dark",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
},
{
"background": "#FFFFFF",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#000000",
"cyan": "#06989A",
"foreground": "#555753",
"green": "#4E9A06",
"name": "Tango Light",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
},
{
"background": "#300A24",
"black": "#171421",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#08458F",
"brightCyan": "#2C9FB3",
"brightGreen": "#26A269",
"brightPurple": "#A347BA",
"brightRed": "#C01C28",
"brightWhite": "#F2F2F2",
"brightYellow": "#A2734C",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#FFFFFF",
"green": "#26A269",
"name": "Ubuntu-ColorScheme",
"purple": "#881798",
"red": "#C21A23",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#A2734C"
},
{
"background": "#000000",
"black": "#000000",
"blue": "#000080",
"brightBlack": "#808080",
"brightBlue": "#0000FF",
"brightCyan": "#00FFFF",
"brightGreen": "#00FF00",
"brightPurple": "#FF00FF",
"brightRed": "#FF0000",
"brightWhite": "#FFFFFF",
"brightYellow": "#FFFF00",
"cursorColor": "#FFFFFF",
"cyan": "#008080",
"foreground": "#C0C0C0",
"green": "#008000",
"name": "Vintage",
"purple": "#800080",
"red": "#800000",
"selectionBackground": "#FFFFFF",
"white": "#C0C0C0",
"yellow": "#808000"
}
],
"themes": [],
"useAcrylicInTabRow": false
}
おわりに
見た目をかっこよくして、開発のモチベーションを上げていきましょう。
コメント