Initial Commit

This commit is contained in:
js0ny 2024-07-19 19:49:26 +08:00
commit 40e939bfb4
42 changed files with 4349 additions and 0 deletions

View file

@ -0,0 +1,99 @@
### Variables ###
$DOTFILES = "$HOME\Documents\.dotfiles"
### PSReadLine ###
Set-PSReadLineOption -EditMode vi # Vi Keybindings
Set-PSReadLineOption -PredictionViewStyle ListView # Prediction View Style
Set-PSReadLineOption -PredictionSource HistoryAndPlugin # Prediction Source
Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Continuation Prompt
### Keybindings ###
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord
### Navigator ###
# Relative navigation #
# ${function:~} = { Set-Location -Path ~ } cd is better
${function:...} = { Set-Location -Path ..\.. }
${function:....} = { Set-Location -Path ..\..\.. }
${function:.....} = { Set-Location -Path ..\..\..\.. }
${function:......} = { Set-Location -Path ..\..\..\..\.. }
# Absolute navigation #
${function:docs} = { Set-Location -Path ~\Documents }
${function:down} = { Set-Location -Path ~\Downloads }
${function:dt} = { Set-Location -Path ~\Desktop }
${function:mytmp} = { Set-Location -Path ~\Temporary }
${function:one} = { Set-Location -Path ~\OneDrive }
${function:doku} = { Set-Location -Path ~\MyDocuments && Get-ChildItem }
### Aliases ###
# Shell Equivalents #
Set-Alias "touch" "New-Item"
Set-Alias "open" "explorer.exe"
# Dev #
${function:shcfg} = { code $PROFILE }
${function:reload} = { Invoke-Expression $PROFILE }
${function:csi} = { dotnet script }
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
Set-Alias "pwshcfg" "shcfg"
Set-Alias "python3" "python"
Set-Alias "pip3" "pip"
Set-Alias "py" "python"
Set-Alias "cl" "clang"
Set-Alias "cl++" "clang++"
Set-Alias "clang" "clang -std=c99"
Set-Alias "clang++" "clang++ -std=c++2b"
# Editors #
Set-Alias "v" "nvim"
Set-Alias "c" "code"
Set-Alias "gvi" "neovide"
# Miscs #
Set-Alias mcd CreateAndSet-Directory
### Functions ###
function tc { param ( [string] $filename)
New-Item $filename && code $filename
}
function tv { param ( [string] $filename)
New-Item $filename && nvim $filename
}
function cdls { param( [string] $dirname)
Set-Location $dirname && Get-ChildItem
}
### Modules ###
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
Import-Module CompletionPredictor
### Misc ###
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
(& "$HOME\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Where-Object{$_} | Invoke-Expression
}
#endregion