Powershell
The profile folder may not always be available on new computer, make it first
mkdir -Force ($profile | split-path)Add these lines into PowerShell profile
Set-PSReadlineKeyHandler -Key ctrl+d -Function ViExit
Set-Alias -Name current_video "$HOME\scripts\rmdir.ps1"
Set-Alias kidm "$HOME\scripts\kidm.ps1"
Set-Alias curl curl.exe -Option AllScope
function ll { Get-ChildItem -Force | Format-Table -AutoSize }
function rmrf($dir) { Remove-Item -Recurse -Force $dir }
function which($name) {
Get-Command $name | Select-Object -ExpandProperty Definition
}
Import-Module 'gsudoModule'
Set-Alias sudo gsudo
Invoke-Expression (& { (zoxide init powershell --cmd cd | Out-String) })
Set-Alias z cd- these will make terminal window exit on ctrl-d
- use the
whichcommand as if on Linux
Ensure the scripts folder are located at $HOME\scripts
- the scripts in these folder are quick scripts also used in task scheduler
- the folder contains the
.ps1files as well as.xmlfile which is used for importing tasks in the scheduler
The scripts in that folder can also be added in powershell alias
new-alias the-alias $env:USERPROFILE/scripts/thescript.ps1Packages
Winget installation doesn’t work over SSH, use choco install
choco install fzf zoxide -yZoxide uses different init command for Powershell
Invoke-Expression (& { (zoxide init powershell --cmd cd | Out-String) })Vim
The Windows version of Vim is gVim
winget install vim.vimAdditional steps is required to add Vim into system path
- must run with Admin
$CurrentPath=[System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
$updatedPath="$currentPath;C:\Program Files\Vim"
[System.Environment]::SetEnvironmentVariable("Path", $UpdatedPath, [System.EnvironmentVariableTarget]::Machine)Reload Path
Afterward, need to manually refresh the path so it’s available in the current session
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")