Skip to content

Instantly share code, notes, and snippets.

@matthiasbaldi
Last active February 26, 2024 06:45
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save matthiasbaldi/6f4fc900849db80c2fa8b7d56658ca02 to your computer and use it in GitHub Desktop.
Save matthiasbaldi/6f4fc900849db80c2fa8b7d56658ca02 to your computer and use it in GitHub Desktop.
Powershell Setup for GitPosh with Windows Terminal
# theming configuration
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
# thanks to https://dev.to/ofhouse/add-a-bash-like-autocomplete-to-your-powershell-4257
# improved tabbing for autocompletion
# Shows navigable menu of all options when hitting Tab
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# Autocompletion for arrow keys
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
# NPM tab autocompletion
# Execute -> Install-Module npm-completion -Scope CurrentUser
Import-Module npm-completion
  • delete profiles.json if you have an old Windows Terminal installation, after a restart the file is recreated with the new schema
  • copy the windows-terminal.json into your profiles.json
# install zsh and git
sudo apt-get install zsh git curl
# download and install oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# set the following snippet to ~/.bashrc to start per default zsh
if test -t 1; then
exec zsh
fi
# change your zsh theme at ~/.zshrc
ZSH_THEME="robbyrussell"
# to
ZSH_THEME="agnoster"
# Install posh-git and oh-my-posh
# first command is only required if you have an old PowerShellGet version
winget install oh-my-posh
# pimp your profile, to start posh-git directly at startup
notepad $PROFILE
# see $PROFILE above for content
# clone and install powerline fonts
git clone https://github.com/powerline/fonts.git
.\fonts\install.ps1
# if you want, install extended fonts: nerdfonts
# Install a Font from here: https://www.nerdfonts.com/
i.e. https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/AnonymousPro.zip
# install explorer extension to open out of context menu
Install-Module OpenHere
Set-OpenHereShortcut -ShortcutType:WindowsTerminal
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
// https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols": 250,
"initialRows": 60,
"initialPosition": "600,200",
"profiles": [
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"startingDirectory": "C:\\projects",
"hidden": false,
"fontFace": "ProFont for Powerline",
"colorScheme": "Dracula"
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
"hidden": false,
"name": "Debian",
"source": "Windows.Terminal.Wsl",
"fontFace": "Anonymice Powerline"
}
],
"fontFace": "ProFont for Powerline",
"colorScheme": "Dracula",
// Add custom color schemes to this array
"schemes": [
{
"name": "Dracula",
"background": "#272935",
"black": "#272935",
"blue": "#BD93F9",
"brightBlack": "#555555",
"brightBlue": "#BD93F9",
"brightCyan": "#8BE9FD",
"brightGreen": "#50FA7B",
"brightPurple": "#FF79C6",
"brightRed": "#FF5555",
"brightWhite": "#FFFFFF",
"brightYellow": "#F1FA8C",
"cyan": "#6272A4",
"foreground": "#F8F8F2",
"green": "#50FA7B",
"purple": "#6272A4",
"red": "#FF5555",
"white": "#F8F8F2",
"yellow": "#FFB86C"
}
],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": [
{
"command": {
"action": "splitPane",
"split": "vertical"
},
"keys": "alt+shift+plus"
},
{
"command": {
"action": "splitPane",
"split": "horizontal"
},
"keys": "alt+shift+-"
},
{
"command": {
"action": "splitPane",
"split": "auto"
},
"keys": "alt+shift+|"
}
]
}
@matthiasbaldi
Copy link
Author

Powershell:
image

WSL:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment