Last active
November 13, 2024 00:57
-
-
Save gitfool/3aa0467597e9f49e11a7549e9ac4c4b8 to your computer and use it in GitHub Desktop.
dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) | |
{ | |
Import-Module "$ChocolateyProfile" | |
} | |
# Import-Module gsudoModule | |
function Cake-Build | |
{ | |
dotnet tool restore && dotnet cake --verbosity=verbose --publish=true $args | |
} | |
function Git-CommitDateVersion | |
{ | |
$branch = git rev-parse --abbrev-ref HEAD | |
if ($branch -eq "HEAD") | |
{ | |
$branch = git name-rev --name-only --refs=refs/heads/* --no-undefined --always HEAD | |
} | |
$branchSlug = [System.Text.RegularExpressions.Regex]::Replace($branch.ToLowerInvariant(), "[^0-9a-z-]", "-").Trim('-') | |
$defaultBranch = $($args[1] ?? "main") | |
$isDefaultBranch = $branch -eq $defaultBranch | |
$isReleaseBranch = $isDefaultBranch -or [System.Text.RegularExpressions.Regex]::IsMatch($branch, "^support/") | |
$commit = git rev-parse $($args[0] ?? "HEAD") | |
$baseCommit = !$isDefaultBranch ? (git merge-base $defaultBranch $commit) : $commit | |
$commits = !$isDefaultBranch ? (git rev-list --count --first-parent "$baseCommit..$commit") : 0 | |
$commitDate = git -c log.showSignature=false show --format="%cI" -s $baseCommit | |
$versionDate = [System.DateTimeOffset]::Parse($commitDate, $null, [System.Globalization.DateTimeStyles]::AdjustToUniversal) | |
$versionDate = $versionDate.AddSeconds($isReleaseBranch ? $commits : 1) | |
$version = $versionDate.ToString("yyMM.dHH.mss") | |
$version = [System.Text.RegularExpressions.Regex]::Replace($version, "(?<=\.)0+(?=\d)", "") | |
$version = $isReleaseBranch ? "$version+branch.$branchSlug.sha.$commit" : "$version-branch.$branchSlug.$commits+sha.$commit" | |
$version | |
} | |
function Which-Command($command) | |
{ | |
$commandInfo = $command -is [System.Management.Automation.CommandInfo] ? $command : (Get-Command -Name $command -ErrorAction SilentlyContinue) | |
if (!$commandInfo) | |
{ | |
Write-Output "$command not found" | |
return | |
} | |
switch ($commandInfo.CommandType) | |
{ | |
"Alias" | |
{ | |
$commandInfo | Format-List CommandType,DisplayName | |
Write-Output "=>" | |
Which-Command $commandInfo.ReferencedCommand | |
} | |
"Application" | |
{ | |
$commandInfo | Format-List CommandType,Name,Path,Version,FileVersionInfo | |
} | |
"Cmdlet" | |
{ | |
$path = @{ Name = "Path"; Expression = { $commandInfo.DLL } } | |
$fileVersionInfo = @{ Name = "FileVersionInfo"; Expression = { [System.Diagnostics.FileVersionInfo]::GetVersionInfo($commandInfo.DLL) } } | |
$commandInfo | Select-Object *,$path,$fileVersionInfo | Format-List CommandType,Name,Definition,HelpUri,Module,ImplementingType,Path,Version,FileVersionInfo | |
} | |
"Function" | |
{ | |
$path = @{ Name = "Path"; Expression = { $commandInfo.ScriptBlock.File } } | |
$commandInfo | Select-Object *,$path | Format-List CommandType,Name,Definition,Path | |
} | |
default | |
{ | |
$commandInfo | Format-List * | |
} | |
} | |
} | |
$env:KUBECONFIG = $(Get-ChildItem ~/.kube | Where-Object { !$_.PSIsContainer -and $_.Name -match 'config[^.]*$' } | Sort-Object | Join-String -Separator ';') | |
New-Alias cake Cake-Build | |
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 msbuild 'C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\MSBuild.exe' | |
New-Alias which Which-Command | |
Set-PSReadLineKeyHandler -Key End -Function AcceptSuggestion | |
# Set-PSReadLineKeyHandler -Key Ctrl+RightArrow -Function AcceptNextSuggestionWord | |
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://starship.rs/config | |
"$schema" = "https://starship.rs/config-schema.json" | |
add_newline = false | |
command_timeout = 1000 | |
format = """$cmd_duration | |
$username\ | |
$hostname\ | |
$localip\ | |
$shlvl\ | |
$singularity\ | |
$kubernetes\ | |
$directory\ | |
$vcsh\ | |
$fossil_branch\ | |
$fossil_metrics\ | |
$git_branch\ | |
$git_commit\ | |
$git_state\ | |
$git_metrics\ | |
$git_status\ | |
$hg_branch\ | |
$pijul_channel\ | |
$docker_context\ | |
$package\ | |
$c\ | |
$cmake\ | |
$cobol\ | |
$daml\ | |
$dart\ | |
$deno\ | |
$dotnet\ | |
$elixir\ | |
$elm\ | |
$erlang\ | |
$fennel\ | |
$gleam\ | |
$golang\ | |
$guix_shell\ | |
$haskell\ | |
$haxe\ | |
$helm\ | |
$java\ | |
$julia\ | |
$kotlin\ | |
$gradle\ | |
$lua\ | |
$nim\ | |
$nodejs\ | |
$ocaml\ | |
$opa\ | |
$perl\ | |
$php\ | |
$pulumi\ | |
$purescript\ | |
$python\ | |
$quarto\ | |
$raku\ | |
$rlang\ | |
$red\ | |
$ruby\ | |
$rust\ | |
$scala\ | |
$solidity\ | |
$swift\ | |
$terraform\ | |
$typst\ | |
$vlang\ | |
$vagrant\ | |
$zig\ | |
$buf\ | |
$nix_shell\ | |
$conda\ | |
$meson\ | |
$spack\ | |
$memory_usage\ | |
$aws\ | |
$gcloud\ | |
$openstack\ | |
$azure\ | |
$nats\ | |
$direnv\ | |
$env_var\ | |
$crystal\ | |
$custom\ | |
$sudo\ | |
$line_break\ | |
$jobs\ | |
$battery\ | |
$time\ | |
$status\ | |
$os\ | |
$container\ | |
$shell\ | |
$character""" | |
[aws] | |
disabled = true | |
symbol = " " | |
[cmd_duration] | |
format = "took [$duration]($style)\n" | |
[directory] | |
style = "bold blue" | |
read_only = "" | |
read_only_style = "dimmed red" | |
truncation_length = 8 | |
truncation_symbol = "… " | |
truncate_to_repo = false | |
before_repo_root_style = "dimmed bold blue" | |
repo_root_style = "bold blue" | |
[dotnet] | |
format = "via [$symbol($version )( $tfm )]($style)" | |
style = "blue" | |
symbol = " " | |
heuristic = true | |
[git_branch] | |
symbol = " " | |
[git_status] | |
style = "bold purple" | |
ahead = "⇡${count}" | |
behind = "⇣${count}" | |
diverged = "⇡${ahead_count}⇣${behind_count}" | |
windows_starship = "/c/users/user/scoop/apps/starship/current/starship.exe" | |
[helm] | |
symbol = "⎈ " | |
[java] | |
style = "dimmed purple" | |
[kubernetes] | |
symbol = "⎈ " | |
[line_break] | |
disabled = false | |
[nodejs] | |
style = "dimmed green" | |
[package] | |
style = "dimmed white" | |
[rust] | |
style = "dimmed red" | |
[shell] | |
disabled = false | |
format = "[$indicator]($style)" | |
style = "bold green" | |
bash_indicator = "bash" | |
cmd_indicator = "cmd" | |
powershell_indicator = "ps" | |
pwsh_indicator = "pwsh" | |
zsh_indicator = "zsh" | |
[shlvl] | |
disabled = false | |
format = "[$symbol]($style) " | |
repeat = true | |
repeat_offset = 1 | |
symbol = "❯" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Scoop instead of Chocolatey (comparison)
scoop install gsudo gsudo config PathPrecedence true # v2.5.0 sudo status
scoop install clink clink autorun install clink set clink.autoupdate off clink set clink.default_bindings bash clink set clink.logo short clink set cmd.ctrld_exits true # init starship; https://chrisant996.github.io/clink/clink.html#starship