update CRLF and update windows script using rclone
This commit is contained in:
parent
4a7609ebf6
commit
32bd3046a4
@ -1,223 +1,223 @@
|
|||||||
##
|
##
|
||||||
## PowerShell®
|
## PowerShell®
|
||||||
## startup environment settings
|
## startup environment settings
|
||||||
## user.sukazyo
|
## user.sukazyo
|
||||||
##
|
##
|
||||||
######
|
######
|
||||||
|
|
||||||
<# =================
|
<# =================
|
||||||
- user variable
|
- user variable
|
||||||
#>
|
#>
|
||||||
$ws = "S:\workspace"
|
$ws = "S:\workspace"
|
||||||
$tests = "S:\__test"
|
$tests = "S:\__test"
|
||||||
|
|
||||||
$gradlearchive = "S:\Document\gradle-builds"
|
$gradlearchive = "S:\Document\gradle-builds"
|
||||||
|
|
||||||
|
|
||||||
<# =================
|
<# =================
|
||||||
- Alias
|
- Alias
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function profile { . $PROFILE }
|
function profile { . $PROFILE }
|
||||||
function source { profile }
|
function source { profile }
|
||||||
function nexplorer { explorer . }
|
function nexplorer { explorer . }
|
||||||
|
|
||||||
function whereis {
|
function whereis {
|
||||||
Get-Command $args | Format-List
|
Get-Command $args | Format-List
|
||||||
}
|
}
|
||||||
|
|
||||||
<# == batcat == #>
|
<# == batcat == #>
|
||||||
Set-Alias -Name cat -Value bat
|
Set-Alias -Name cat -Value bat
|
||||||
|
|
||||||
<# == lsd (colorls before) == #>
|
<# == lsd (colorls before) == #>
|
||||||
#source $(dirname $(gem which colorls))/tab_complete.sh
|
#source $(dirname $(gem which colorls))/tab_complete.sh
|
||||||
function cols {
|
function cols {
|
||||||
lsd $args
|
lsd $args
|
||||||
}
|
}
|
||||||
function crls {
|
function crls {
|
||||||
cols @args
|
cols @args
|
||||||
}
|
}
|
||||||
function ccls {
|
function ccls {
|
||||||
#theres no git (--gs) support due to slow performance and bugs on Windows
|
#theres no git (--gs) support due to slow performance and bugs on Windows
|
||||||
crls @args
|
crls @args
|
||||||
}
|
}
|
||||||
function cl {
|
function cl {
|
||||||
$args_new = @("-lA") + $args
|
$args_new = @("-lA") + $args
|
||||||
ccls @args_new
|
ccls @args_new
|
||||||
}
|
}
|
||||||
function cll {
|
function cll {
|
||||||
$args_new = @("-l") + $args
|
$args_new = @("-l") + $args
|
||||||
ccls @args_new
|
ccls @args_new
|
||||||
}
|
}
|
||||||
function cla {
|
function cla {
|
||||||
$args_new = @("-la") + $args
|
$args_new = @("-la") + $args
|
||||||
ccls @args_new
|
ccls @args_new
|
||||||
}
|
}
|
||||||
function lc {
|
function lc {
|
||||||
ccls @args
|
ccls @args
|
||||||
}
|
}
|
||||||
Set-Alias -Name ls -Value lc # override system ls
|
Set-Alias -Name ls -Value lc # override system ls
|
||||||
function l { cl @args }
|
function l { cl @args }
|
||||||
function ll { cll @args }
|
function ll { cll @args }
|
||||||
function la { cla @args }
|
function la { cla @args }
|
||||||
function lgg {
|
function lgg {
|
||||||
$args_new = @("--tree") + $args
|
$args_new = @("--tree") + $args
|
||||||
ccls @args_new
|
ccls @args_new
|
||||||
}
|
}
|
||||||
|
|
||||||
<# == zoxide cd == #>
|
<# == zoxide cd == #>
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
#
|
#
|
||||||
# Utility functions for zoxide.
|
# Utility functions for zoxide.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Call zoxide binary, returning the output as UTF-8.
|
# Call zoxide binary, returning the output as UTF-8.
|
||||||
function global:__zoxide_bin {
|
function global:__zoxide_bin {
|
||||||
$encoding = [Console]::OutputEncoding
|
$encoding = [Console]::OutputEncoding
|
||||||
try {
|
try {
|
||||||
[Console]::OutputEncoding = [System.Text.Utf8Encoding]::new()
|
[Console]::OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||||
$result = zoxide @args
|
$result = zoxide @args
|
||||||
return $result
|
return $result
|
||||||
} finally {
|
} finally {
|
||||||
[Console]::OutputEncoding = $encoding
|
[Console]::OutputEncoding = $encoding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# pwd based on zoxide's format.
|
# pwd based on zoxide's format.
|
||||||
function global:__zoxide_pwd {
|
function global:__zoxide_pwd {
|
||||||
$cwd = Get-Location
|
$cwd = Get-Location
|
||||||
if ($cwd.Provider.Name -eq "FileSystem") {
|
if ($cwd.Provider.Name -eq "FileSystem") {
|
||||||
$cwd.ProviderPath
|
$cwd.ProviderPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# cd + custom logic based on the value of _ZO_ECHO.
|
# cd + custom logic based on the value of _ZO_ECHO.
|
||||||
function global:__zoxide_cd($dir, $literal) {
|
function global:__zoxide_cd($dir, $literal) {
|
||||||
$dir = if ($literal) {
|
$dir = if ($literal) {
|
||||||
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
|
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
|
||||||
} else {
|
} else {
|
||||||
if ($dir -eq '-' -and ($PSVersionTable.PSVersion -lt 6.1)) {
|
if ($dir -eq '-' -and ($PSVersionTable.PSVersion -lt 6.1)) {
|
||||||
Write-Error "cd - is not supported below PowerShell 6.1. Please upgrade your version of PowerShell."
|
Write-Error "cd - is not supported below PowerShell 6.1. Please upgrade your version of PowerShell."
|
||||||
}
|
}
|
||||||
elseif ($dir -eq '+' -and ($PSVersionTable.PSVersion -lt 6.2)) {
|
elseif ($dir -eq '+' -and ($PSVersionTable.PSVersion -lt 6.2)) {
|
||||||
Write-Error "cd + is not supported below PowerShell 6.2. Please upgrade your version of PowerShell."
|
Write-Error "cd + is not supported below PowerShell 6.2. Please upgrade your version of PowerShell."
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Set-Location -Path $dir -Passthru -ErrorAction Stop
|
Set-Location -Path $dir -Passthru -ErrorAction Stop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
#
|
#
|
||||||
# Hook configuration for zoxide.
|
# Hook configuration for zoxide.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Hook to add new entries to the database.
|
# Hook to add new entries to the database.
|
||||||
$global:__zoxide_oldpwd = __zoxide_pwd
|
$global:__zoxide_oldpwd = __zoxide_pwd
|
||||||
function global:__zoxide_hook {
|
function global:__zoxide_hook {
|
||||||
$result = __zoxide_pwd
|
$result = __zoxide_pwd
|
||||||
if ($result -ne $global:__zoxide_oldpwd) {
|
if ($result -ne $global:__zoxide_oldpwd) {
|
||||||
if ($null -ne $result) {
|
if ($null -ne $result) {
|
||||||
zoxide add -- $result
|
zoxide add -- $result
|
||||||
}
|
}
|
||||||
$global:__zoxide_oldpwd = $result
|
$global:__zoxide_oldpwd = $result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize hook.
|
# Initialize hook.
|
||||||
$global:__zoxide_hooked = (Get-Variable __zoxide_hooked -ErrorAction SilentlyContinue -ValueOnly)
|
$global:__zoxide_hooked = (Get-Variable __zoxide_hooked -ErrorAction SilentlyContinue -ValueOnly)
|
||||||
if ($global:__zoxide_hooked -ne 1) {
|
if ($global:__zoxide_hooked -ne 1) {
|
||||||
$global:__zoxide_hooked = 1
|
$global:__zoxide_hooked = 1
|
||||||
$global:__zoxide_prompt_old = $function:prompt
|
$global:__zoxide_prompt_old = $function:prompt
|
||||||
|
|
||||||
function global:prompt {
|
function global:prompt {
|
||||||
if ($null -ne $__zoxide_prompt_old) {
|
if ($null -ne $__zoxide_prompt_old) {
|
||||||
& $__zoxide_prompt_old
|
& $__zoxide_prompt_old
|
||||||
}
|
}
|
||||||
$null = __zoxide_hook
|
$null = __zoxide_hook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
#
|
#
|
||||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Jump to a directory using only keywords.
|
# Jump to a directory using only keywords.
|
||||||
function global:__zoxide_z {
|
function global:__zoxide_z {
|
||||||
if ($args.Length -eq 0) {
|
if ($args.Length -eq 0) {
|
||||||
__zoxide_cd ~ $true
|
__zoxide_cd ~ $true
|
||||||
}
|
}
|
||||||
elseif ($args.Length -eq 1 -and ($args[0] -eq '-' -or $args[0] -eq '+')) {
|
elseif ($args.Length -eq 1 -and ($args[0] -eq '-' -or $args[0] -eq '+')) {
|
||||||
__zoxide_cd $args[0] $false
|
__zoxide_cd $args[0] $false
|
||||||
}
|
}
|
||||||
elseif ($args.Length -eq 1 -and (Test-Path $args[0] -PathType Container)) {
|
elseif ($args.Length -eq 1 -and (Test-Path $args[0] -PathType Container)) {
|
||||||
__zoxide_cd $args[0] $true
|
__zoxide_cd $args[0] $true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = __zoxide_pwd
|
$result = __zoxide_pwd
|
||||||
if ($null -ne $result) {
|
if ($null -ne $result) {
|
||||||
$result = __zoxide_bin query --exclude $result -- @args
|
$result = __zoxide_bin query --exclude $result -- @args
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = __zoxide_bin query -- @args
|
$result = __zoxide_bin query -- @args
|
||||||
}
|
}
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
__zoxide_cd $result $true
|
__zoxide_cd $result $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Jump to a directory using interactive search.
|
# Jump to a directory using interactive search.
|
||||||
function global:__zoxide_zi {
|
function global:__zoxide_zi {
|
||||||
$result = __zoxide_bin query -i -- @args
|
$result = __zoxide_bin query -i -- @args
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
__zoxide_cd $result $true
|
__zoxide_cd $result $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
#
|
#
|
||||||
# Commands for zoxide. Disable these using --no-cmd.
|
# Commands for zoxide. Disable these using --no-cmd.
|
||||||
#
|
#
|
||||||
|
|
||||||
Set-Alias -Name z -Value __zoxide_z -Option AllScope -Scope Global -Force
|
Set-Alias -Name z -Value __zoxide_z -Option AllScope -Scope Global -Force
|
||||||
Set-Alias -Name zi -Value __zoxide_zi -Option AllScope -Scope Global -Force
|
Set-Alias -Name zi -Value __zoxide_zi -Option AllScope -Scope Global -Force
|
||||||
Remove-Alias cd
|
Remove-Alias cd
|
||||||
Set-Alias -Name cd -Value z
|
Set-Alias -Name cd -Value z
|
||||||
Set-Alias -Name cdi -Value zi
|
Set-Alias -Name cdi -Value zi
|
||||||
|
|
||||||
<# =================
|
<# =================
|
||||||
- TOOLCHAILS
|
- TOOLCHAILS
|
||||||
#>
|
#>
|
||||||
|
|
||||||
<# === Chocolatey === #>
|
<# === Chocolatey === #>
|
||||||
|
|
||||||
# $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
# $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||||
# if (Test-Path($ChocolateyProfile)) {
|
# if (Test-Path($ChocolateyProfile)) {
|
||||||
# Import-Module "$ChocolateyProfile"
|
# Import-Module "$ChocolateyProfile"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
<# === Oh-My-Posh === #>
|
<# === Oh-My-Posh === #>
|
||||||
|
|
||||||
# $USE_POSH_THEME = "catppuccin"
|
# $USE_POSH_THEME = "catppuccin"
|
||||||
# $USE_POSH_THEME = "chips"
|
# $USE_POSH_THEME = "chips"
|
||||||
# $USE_POSH_THEME = "emodipt-extend" # original
|
# $USE_POSH_THEME = "emodipt-extend" # original
|
||||||
# $USE_POSH_THEME = "hunk"
|
# $USE_POSH_THEME = "hunk"
|
||||||
# $USE_POSH_THEME = "multiverse-neon"
|
# $USE_POSH_THEME = "multiverse-neon"
|
||||||
# $USE_POSH_THEME = "negligible"
|
# $USE_POSH_THEME = "negligible"
|
||||||
# $USE_POSH_THEME = "peru"
|
# $USE_POSH_THEME = "peru"
|
||||||
# $USE_POSH_THEME = "pure"
|
# $USE_POSH_THEME = "pure"
|
||||||
# $USE_POSH_THEME = "ys"
|
# $USE_POSH_THEME = "ys"
|
||||||
$USE_POSH_THEME = "sukazyo"
|
$USE_POSH_THEME = "sukazyo"
|
||||||
|
|
||||||
oh-my-posh init pwsh --config "$HOME\.config\oh-my-posh\$USE_POSH_THEME.omp.json" | Invoke-Expression
|
oh-my-posh init pwsh --config "$HOME\.config\oh-my-posh\$USE_POSH_THEME.omp.json" | Invoke-Expression
|
||||||
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\$USE_POSH_THEME.omp.json" | Invoke-Expression
|
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\$USE_POSH_THEME.omp.json" | Invoke-Expression
|
||||||
|
|
||||||
<# === Others Auto Generated === #>
|
<# === Others Auto Generated === #>
|
||||||
|
|
||||||
#34de4b3d-13a8-4540-b76d-b9e8d3851756 PowerToys CommandNotFound module
|
#34de4b3d-13a8-4540-b76d-b9e8d3851756 PowerToys CommandNotFound module
|
||||||
Import-Module "C:\Program Files\PowerToys\WinUI3Apps\..\WinGetCommandNotFound.psd1"
|
Import-Module "C:\Program Files\PowerToys\WinUI3Apps\..\WinGetCommandNotFound.psd1"
|
||||||
#34de4b3d-13a8-4540-b76d-b9e8d3851756
|
#34de4b3d-13a8-4540-b76d-b9e8d3851756
|
||||||
|
15
windows_archive.ps1
Normal file
15
windows_archive.ps1
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
$path_colorls = "$HOME/.config/colorls/"
|
||||||
|
$path_lsd = "$HOME/AppData/Roaming/lsd/"
|
||||||
|
$path_PowerShell = "$HOME/Documents/PowerShell/"
|
||||||
|
$path_neofetch = "$HOME/.config/neofetch/"
|
||||||
|
$path_oh_my_posh = "$HOME/.config/oh-my-posh/"
|
||||||
|
$path_hyfetch = "$HOME/.config/hyfetch.json"
|
||||||
|
$path_bat = "$HOME/AppData/Roaming/bat/"
|
||||||
|
|
||||||
|
rclone sync --create-empty-src-dirs -v $path_colorls ./colorls/
|
||||||
|
rclone sync --create-empty-src-dirs -v $path_lsd ./lsd/
|
||||||
|
rclone sync --create-empty-src-dirs -v $path_PowerShell ./PowerShell/ --exclude 'Modules/' --exclude 'Scripts/'
|
||||||
|
rclone sync --create-empty-src-dirs -v $path_neofetch ./neofetch/
|
||||||
|
rclone sync --create-empty-src-dirs -v $path_oh_my_posh ./oh-my-posh/
|
||||||
|
rclone copyto -v $path_hyfetch ./hyfetch.json
|
||||||
|
rclone sync --create-empty-src-dirs -v $path_bat ./bat/
|
15
windows_restore.ps1
Normal file
15
windows_restore.ps1
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
$path_colorls = "$HOME/.config/colorls/"
|
||||||
|
$path_lsd = "$HOME/AppData/Roaming/lsd/"
|
||||||
|
$path_PowerShell = "$HOME/Documents/PowerShell/"
|
||||||
|
$path_neofetch = "$HOME/.config/neofetch/"
|
||||||
|
$path_oh_my_posh = "$HOME/.config/oh-my-posh/"
|
||||||
|
$path_hyfetch = "$HOME/.config/hyfetch.json"
|
||||||
|
$path_bat = "$HOME/AppData/Roaming/bat/"
|
||||||
|
|
||||||
|
rclone sync --create-empty-src-dirs -v ./colorls/ $path_colorls
|
||||||
|
rclone sync --create-empty-src-dirs -v ./lsd/ $path_lsd
|
||||||
|
rclone sync --create-empty-src-dirs -v ./PowerShell/ $path_PowerShell --exclude 'Modules/' --exclude 'Scripts/'
|
||||||
|
rclone sync --create-empty-src-dirs -v ./neofetch/ $path_neofetch
|
||||||
|
rclone sync --create-empty-src-dirs -v ./oh-my-posh/ $path_oh_my_posh
|
||||||
|
rclone copyto -v ./hyfetch.json $path_hyfetch
|
||||||
|
rclone sync --create-empty-src-dirs -v ./bat/ $path_bat
|
@ -1,23 +0,0 @@
|
|||||||
$path_colorls = "~/.config/colorls/"
|
|
||||||
$path_lsd = "~/AppData/Roaming/lsd/"
|
|
||||||
$path_PowerShell = "~/Documents/PowerShell/"
|
|
||||||
$path_neofetch = "~/.config/neofetch/"
|
|
||||||
$path_oh_my_posh = "~/.config/oh-my-posh/"
|
|
||||||
$path_hyfetch = "~/.config/hyfetch.json"
|
|
||||||
$path_bat = "~/AppData/Roaming/bat/"
|
|
||||||
|
|
||||||
rsync -avh $path_colorls ./colorls/
|
|
||||||
rsync -avh $path_lsd ./lsd/
|
|
||||||
rsync -avh $path_PowerShell ./PowerShell/ --exclude 'Modules/' --exclude 'Scripts/'
|
|
||||||
rsync -avh $path_neofetch ./neofetch/
|
|
||||||
rsync -avh $path_oh_my_posh ./oh-my-posh/
|
|
||||||
rsync -avh $path_hyfetch ./hyfetch.json
|
|
||||||
rsync -avh $path_bat ./bat/
|
|
||||||
|
|
||||||
rsync -avh ./colorls/ $path_colorls
|
|
||||||
rsync -avh ./lsd/ $path_lsd
|
|
||||||
rsync -avh ./PowerShell/ $path_PowerShell --exclude 'Modules/' --exclude 'Scripts/'
|
|
||||||
rsync -avh ./neofetch/ $path_neofetch
|
|
||||||
rsync -avh ./oh-my-posh/ $path_oh_my_posh
|
|
||||||
rsync -avh ./hyfetch.json $path_hyfetch
|
|
||||||
rsync -avh ./bat/ $path_bat
|
|
Loading…
Reference in New Issue
Block a user