Skip to content

Instantly share code, notes, and snippets.

@souhaiebtar
Created May 3, 2024 20:14
Show Gist options
  • Save souhaiebtar/c6ad1564eae9a7004eb3138aca1721f5 to your computer and use it in GitHub Desktop.
Save souhaiebtar/c6ad1564eae9a7004eb3138aca1721f5 to your computer and use it in GitHub Desktop.
[powershel-starship profile] powershell starship profile #powershell #starship #shell
1.6.3133.0 Microsoft.WinGet.Client PSGallery PowerShell Module for the Window…
2.5.19 PSFzf PSGallery A thin wrapper around Fzf (https…
2.2.2 PSReadLine PSGallery Great command line editing in th…
0.11.0 Terminal-Icons PSGallery PowerShell module to add file ic…
# create symbolic link
new-item -Path litexl -ItemType SymbolicLink -Value C:\Users\starhoun\tools\litexl\lite-xl.exe
# $PROFILE file content
Import-Module Terminal-Icons
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
function fact {
irm -Uri https://uselessfacts.jsph.pl/random.json?language=en | Select -ExpandProperty text
}
function joke {
irm https://icanhazdadjoke.com/ -Headers @{accept = 'application/json'} | select -ExpandProperty joke
}
function toggleAutoHide {
$location = @{Path = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3'; Name = 'Settings'}
$value = Get-ItemPropertyValue @location
$value[8] = if ($value[8] -Eq 122) {123} Else {122}
Set-ItemProperty @location $value
Stop-Process -Name Explorer
}
function 2C {
param (
[Parameter()]
[Alias('Temp')]
[int]
$Temperature
)
($Temperature - 30) / 2
}
function 2F {
param (
[Parameter()]
[Alias('Temp')]
[int]
$Temperature
)
($Temperature * 2) + 30
}
# function update {
# iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
# }
function profile {
code $profile
}
Set-Alias -Name which -Value Get-Command
Set-Alias -Name open -Value explorer
set-Alias -Name clip -Value Set-Clipboard
#34de4b3d-13a8-4540-b76d-b9e8d3851756 PowerToys CommandNotFound module
Import-Module "C:\Program Files\PowerToys\WinUI3Apps\..\WinGetCommandNotFound.psd1"
#34de4b3d-13a8-4540-b76d-b9e8d3851756
#region mamba initialize
# !! Contents within this block are managed by 'mamba shell init' !!
$Env:MAMBA_ROOT_PREFIX = "C:\Users\starhoun\micromamba"
$Env:MAMBA_EXE = "C:\Users\starhoun\AppData\Local\micromamba\micromamba.exe"
(& $Env:MAMBA_EXE 'shell' 'hook' -s 'powershell' -p $Env:MAMBA_ROOT_PREFIX) | Out-String | Invoke-Expression
#endregion
$ENV:STARSHIP_CONFIG = "$HOME\.config\starship\starship.toml"
Invoke-Expression (& Starship init powershell)
clear
-----
'starship.toml` file content
# SOURCES
# https://starship.rs/config
# https://starship.rs/presets/nerd-font.html#configuration
# DEBUG via:
# starship explain
# STARSHIP_LOG=trace
"$schema" = 'https://starship.rs/config-schema.json'
# Timeout for commands executed by starship (ms)
command_timeout = 1000
# newline between commands
add_newline = true
# ! opt-in for individual modules (e.g., aws, docker, gcloud, nodejs, python)
# standalone format to get os glyph on ps1 line,
# prompt character below
format = """$os$username$hostname:$directory$git_branch$git_status$git_commit$python $cmd_duration$character"""
# Replace the "❯"
[character]
success_symbol = "[λ](green)"
error_symbol = "[λ](red)"
[username]
style_user = "green bold"
style_root = "red bold"
format = "[$user]($style)"
disabled = false
show_always = true
[hostname]
ssh_only = false
format = "[@$hostname](green bold)"
disabled = false
# truncation length works backwards (i.e., cwd > parent > parent ...)
[directory]
truncation_length = 15
truncation_symbol = "…/"
truncate_to_repo = true
[git_branch]
truncation_length = 25
truncation_symbol = ''
[git_status]
ahead = '⇡${count}'
diverged = '⇕⇡${ahead_count}⇣${behind_count}'
behind = '⇣${count}'
staged = '[++\($count\)](green)'
[git_commit]
commit_hash_length = 4
[env_var.SHELL]
variable = "SHELL"
default = "unknown shell"
disabled = true
[cmd_duration]
min_time = 500
format = '[$duration](bold yellow) '
# Show python version starting with venv
[python]
python_binary = ["./venv/bin/python", "python3", "python", "python2"]
[aws]
disabled = true
[docker_context]
disabled = true
[gcloud]
disabled = true
[nodejs]
disabled = true
[os]
format = '[$symbol](bold blue)'
disabled = false
[os.symbols]
Alpaquita = " "
Alpine = " "
Amazon = " "
Android = " "
Arch = " "
Artix = " "
CentOS = " "
Debian = " "
DragonFly = " "
Emscripten = " "
EndeavourOS = " "
Fedora = " "
FreeBSD = " "
Garuda = "󰛓 "
Gentoo = " "
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Linux = " "
Mabox = " "
Macos = " "
Manjaro = " "
Mariner = " "
MidnightBSD = " "
Mint = " "
NetBSD = " "
NixOS = " "
OpenBSD = "󰈺 "
openSUSE = " "
OracleLinux = "󰌷 "
Pop = " "
Raspbian = " "
Redhat = " "
RedHatEnterprise = " "
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = " "
Ubuntu = " "
Unknown = " "
Windows = "󰍲 "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment