mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
Update PowerShell Structures
This commit is contained in:
parent
7d933a0b16
commit
d400f65ae7
8 changed files with 100 additions and 222 deletions
|
|
@ -5,56 +5,13 @@ $DOTFILES = "$HOME\Documents\.dotfiles"
|
|||
### Load Configs ###
|
||||
|
||||
Get-ChildItem -Path $DOTFILES\powershell -Filter *.ps1 | ForEach-Object {. $_}
|
||||
|
||||
### 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+Shift+f" -Function ForwardWord
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+b" -Function BackwardWord
|
||||
Set-PSReadLineKeyHandler -Chord "Alt+f" -Function ForwardChar
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+b" -Function BackwardChar
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function HistorySearchBackward
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function HistorySearchForward
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
||||
|
||||
### 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 }
|
||||
Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object {. $_}
|
||||
|
||||
### Aliases ###
|
||||
|
||||
# Shell Equivalents #
|
||||
|
||||
Set-Alias "touch" "New-Item"
|
||||
function open {
|
||||
if ($args.Count -eq 0) {
|
||||
explorer.exe .
|
||||
} else {
|
||||
explorer.exe $args[0]
|
||||
}
|
||||
}
|
||||
Set-Alias "open" "Invoke-Item" # Use ii instead of explorer.exe
|
||||
|
||||
# Shell Configurations #
|
||||
|
||||
|
|
@ -62,11 +19,6 @@ ${function:shcfg} = { code $PROFILE }
|
|||
${function:reload} = { . $PROFILE }
|
||||
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
|
||||
Set-Alias "pwshcfg" "shcfg"
|
||||
|
||||
# Dotnet #
|
||||
|
||||
${function:csi} = { dotnet script }
|
||||
|
||||
# C & C++ #
|
||||
|
||||
# Set-Alias "cl" "clang"
|
||||
|
|
@ -78,13 +30,8 @@ ${function:csi} = { dotnet script }
|
|||
|
||||
Set-Alias "python3" "python"
|
||||
Set-Alias "pip3" "pip"
|
||||
Set-Alias "py" "python"
|
||||
${function:pyact} = { conda activate $args[0] }
|
||||
${function:pylsenvs} = { conda env list }
|
||||
${function:pydact} = { conda deactivate }
|
||||
${function:pymkenv} = { conda create --name $args[0] }
|
||||
|
||||
# # Git #
|
||||
# Git #
|
||||
|
||||
# Set-Alias "g" "git"
|
||||
# Set-Alias "ginit" "git init"
|
||||
|
|
@ -104,26 +51,14 @@ ${function:pymkenv} = { conda create --name $args[0] }
|
|||
${function:wsl1} = {wsl.exe --distribution Debian}
|
||||
${function:wsl2} = {wsl.exe --distribution Ubuntu-22.04}
|
||||
|
||||
# Editors #
|
||||
|
||||
Set-Alias "v" "nvim"
|
||||
Set-Alias "c" "code"
|
||||
Set-Alias "gvi" "neovide"
|
||||
|
||||
# Miscs #
|
||||
|
||||
|
||||
### Functions ###
|
||||
|
||||
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname}
|
||||
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 ###
|
||||
|
||||
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
|
||||
Import-Module CompletionPredictor
|
||||
# Import-Module syntax-highlighting # Buggy
|
||||
|
||||
### Misc ###
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue