Compare commits

...

4 Commits

4 changed files with 49 additions and 1 deletions

View File

@ -3,6 +3,7 @@
{{- $category := promptString "Server category" -}}
{{- $color := promptString "Prompt color (see https://unix.stackexchange.com/questions/269077/tput-setaf-color-table-how-to-determine-color-codes)" -}}
{{- $vimexec := promptString "Which vi executable to use? (vi, vim, nvim)" -}}
{{- $promptType := promptString "Which prompt to use? (starship, oh-my-posh, none)" -}}
[data]
name = "{{ $name }}"
email = "{{ $email }}"
@ -10,3 +11,4 @@
bash.prompt.category = "{{ $category }}"
bash.prompt.color = "{{ $color }}"
bash.prompt.type = "{{ $promptType }}"

View File

@ -1,4 +1,6 @@
{{ if eq .bash.prompt.type "oh-my-posh" }}
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\atomic.omp.json" | Invoke-Expression
{{ end }}
function Get-LastN {
param (
@ -21,6 +23,20 @@ function Net-Cat() {
Test-NetConnection -ComputerName $computerName -Port $port -InformationLevel Detailed
}
# History with search
function hist {
$find = $args
Write-Host "Finding in full history using {`$_ -like `"*$find*`"}"
Get-Content (Get-PSReadlineOption).HistorySavePath | ? {$_ -like "*$find*"} | Get-Unique | more
}
# Reverse History Search
# Found at https://stackoverflow.com/questions/62883762/powershell-bind-arrow-keys-to-command-history-search
#
# Set-PSReadlineKeyHandler will list all mapped keys
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadlineKeyHandler -Key PageUp -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key PageDown -Function HistorySearchForward
# Navigate one directory up
function Go-One-Level-Up {
cd ..
@ -38,3 +54,12 @@ Set-Alias ... Go-Two-Levels-Up
# More Aliases
Set-Alias vi nvim
Set-Alias vim nvim
Set-Alias ll dir
function gg {
git graph
}
{{ if eq .bash.prompt.type "starship" }}
Invoke-Expression (&starship init powershell)
{{ end }}

View File

@ -16,7 +16,7 @@ function backup
function forget
{
restic --keep-daily 2 --keep-weekly 2 --keep-monthly 5
restic forget --keep-daily 2 --keep-weekly 2 --keep-monthly 5
}
function list()
@ -30,4 +30,5 @@ switch($action) {
"list" { list }
"snapshots" { restic snapshots }
"stats" { restic stats }
default { Write-Host "xxx" }
}

View File

@ -17,6 +17,7 @@ $kubernetes\
[](fg:#212736 bg:#1d2230)\
$time\
[ ](fg:#1d2230)\
$battery \
\n$character"""
[os]
@ -95,6 +96,25 @@ style = "fg:#769ff0 bg:#212736"
format = '[[ $symbol $context \($namespace\)](fg:#769ff0 bg:#212736)]($style)'
disabled = false
[battery]
#full_symbol = '🔋 '
#charging_symbol = '⚡️ '
#discharging_symbol = '💀 '
#style = "bg:#1d2230"
#format = '[[$symbol$percentage](bg:#1d2230)]($style) '
[[battery.display]]
threshold = 30
style = 'bold red'
[[battery.display]]
threshold = 50
style = 'bold yellow'
[[battery.display]]
threshold = 80
style = 'bold green'
[custom.category]
command = 'echo "[{{ .bash.prompt.category }}]"'
when = true