Skip to content

Instantly share code, notes, and snippets.

@gitfool
Last active April 22, 2024 20:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitfool/3aa0467597e9f49e11a7549e9ac4c4b8 to your computer and use it in GitHub Desktop.
Save gitfool/3aa0467597e9f49e11a7549e9ac4c4b8 to your computer and use it in GitHub Desktop.
dotfiles
export HISTCONTROL='ignorespace:ignoredups'
export HISTIGNORE='bg:fg:clear:exit:h:history:l:l[ls]:pwd'
export HISTSIZE=10000
export AWS_PAGER=
export EDITOR=vi
export KUBECONFIG=$(find ~/.kube -maxdepth 1 -type f 2>/dev/null | grep -E 'config[^.]*$' | xargs -I{} -r echo -n ':{}')
export PATH=$HOME/.dotnet/tools:$PATH
alias h='history'
alias l='ls -aF'
alias ll='ls -ahlF'
alias ls='ls --color=auto --group-directories-first'
alias cake='_cake() { local args="$@"; bash -c "dotnet tool restore && dotnet cake --verbosity=verbose $args"; }; _cake'
alias cake-docker='_cake() { local args="$@"; docker run -it --rm --user user -w /build -v "$(pwd):/build" -v /var/run/docker.sock:/var/run/docker.sock -v /home/sean/.nuget:/home/user/.nuget -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_REGION dockfool/cake-docker bash -c "dotnet tool restore && dotnet cake --verbosity=verbose $args"; }; _cake'
eval "$(starship init bash)"
export ZSH="/home/sean/.oh-my-zsh"
ZSH_THEME=""
COMPLETION_WAITING_DOTS="true"
plugins=(
aws
docker
dotnet
# git
# kube-ps1
kubectl
zsh-autosuggestions
zsh-syntax-highlighting
history-substring-search
)
source $ZSH/oh-my-zsh.sh
HISTORY_IGNORE='(bg|fg|clear|exit|h|history|l|l[als]|pwd)'
HISTSIZE=10000
export AWS_PAGER=
export EDITOR=vi
export KUBECONFIG=$(find ~/.kube -maxdepth 1 -type f 2>/dev/null | grep -E 'config[^.]*$' | xargs -I{} -r echo -n ':{}')
export PATH=$HOME/.dotnet/tools:$PATH
alias h='history'
alias l='ls -aF'
alias ll='ls -ahlF'
alias ls='ls --color=auto --group-directories-first'
alias cake='_cake() { local args="$@"; bash -c "dotnet tool restore && dotnet cake --verbosity=verbose $args"; }; _cake'
alias cake-docker='_cake() { local args="$@"; docker run -it --rm --user user -w /build -v "$(pwd):/build" -v /var/run/docker.sock:/var/run/docker.sock -v /home/sean/.nuget:/home/user/.nuget -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_REGION dockfool/cake-docker bash -c "dotnet tool restore && dotnet cake --verbosity=verbose $args"; }; _cake'
setopt SH_WORD_SPLIT
eval "$(starship init zsh)"
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile))
{
Import-Module "$ChocolateyProfile"
}
function Cake-Build
{
dotnet tool restore && dotnet cake --verbosity=verbose $args
}
function Git-Clean
{
git clean -ffxd
}
function Which-Command ($command)
{
Get-Command -Name $command -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
}
$env:KUBECONFIG=$(Get-ChildItem ~/.kube | Where-Object { !$_.PSIsContainer -and $_.Name -match 'config[^.]*$' } | Join-String -Separator ';')
New-Alias cake Cake-Build
New-Alias clean Git-Clean
New-Alias grep 'C:\Program Files\Git\usr\bin\grep.exe'
New-Alias less 'C:\Program Files\Git\usr\bin\less.exe'
New-Alias l ls
New-Alias ll ls
New-Alias which Which-Command
Set-PSReadLineKeyHandler -Key End -Function AcceptSuggestion
Set-PSReadLineKeyHandler -Key Ctrl+u -Function BackwardKillLine
Set-PSReadLineKeyHandler -Key Ctrl+w -Function BackwardKillWord
Set-PSReadLineKeyHandler -Key Tab -Function Complete
Set-PSReadLineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineKeyHandler -Key Ctrl+k -Function KillLine
Set-PSReadLineKeyHandler -Key Alt+d -Function KillWord
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -PredictionSource History
Invoke-Expression (&starship init powershell)
# https://starship.rs/config
format = "$all"
add_newline = true
[aws]
# format = "on [$symbol($profile )(\($region\) )(\[$duration\])]($style)"
symbol = " "
disabled = true
[character]
# format = "$symbol "
success_symbol = "[❯](bold green)"
# error_symbol = "[✗](bold red)"
[directory]
# format = "[$path]($style)[$read_only]($read_only_style) "
style = "bold blue"
read_only = ""
read_only_style = "dimmed red"
truncation_length = 4
truncation_symbol = "… "
truncate_to_repo = true
[dotnet]
# format = "via [$symbol($version )(🎯 $tfm )]($style)"
# symbol = " "
symbol = "dotnet "
style = "blue"
heuristic = true
[git_branch]
# format = "on [$symbol$branch]($style) "
symbol = " "
[git_status]
# format = "([\[$all_status$ahead_behind\]]($style) )"
style = "bold purple"
ahead = "⇡${count}"
behind = "⇣${count}"
diverged = "⇡${ahead_count}⇣${behind_count}"
[helm]
# format = "via [$symbol($version )]($style)"
symbol = "⎈ "
[java]
# format = "via [${symbol}(${version} )]($style)"
style = "dimmed purple"
[jobs]
# format = "[$symbol$number]($style) "
threshold = 1
[kubernetes]
# format = "[$symbol$context( \($namespace\))]($style) in "
symbol = "⎈ "
[line_break]
disabled = false
[nodejs]
# format = "via [$symbol($version )]($style)"
style = "dimmed green"
[package]
# format = "is [$symbol$version]($style) "
style = "dimmed white"
[rust]
# format = "via [$symbol($version )]($style)"
style = "dimmed red"
@gitfool
Copy link
Author

gitfool commented Apr 25, 2020

Windows Prerequisites

Download patched Fira Code v3.2.1, extract and install all the TrueType fonts, matching name FiraCodeNerdFont-*.ttf, for all users. Currently Bold, Light, Medium, Regular, Retina and SemiBold variants.

  • Configure Windows Terminal to use this font:
{ "profiles": { "defaults": { "font": { "face": "FiraCode Nerd Font" } } } }
  • Install Chocolatey (FAQ) package manager using an elevated PowerShell:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  • Install Starship (FAQ) cross-shell prompt using Chocolately:
choco install starship

@gitfool
Copy link
Author

gitfool commented Apr 20, 2024

Using Scoop instead of Chocolatey (comparison)

  • Install Scoop (FAQ) using a non-elevated PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
scoop install aria2
# scoop config aria2-enabled false
# scoop config aria2-warning-enabled false
scoop install gsudo
sudo status
  • Install FiraCode Nerd Font
scoop bucket add nerd-fonts
scoop install nerd-fonts/FiraCode-NF
  • Update scoop and apps
scoop status
scoop update && scoop update --all && scoop cleanup --all

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