# Run Git Status on Enter With Empty Line in PowerShell
## Metadata
**Status**:: #x
**Zettel**:: #zettel/permanent
**Created**:: [[2025-03-30]]
## Synopsis
This PowerShell code snippet modifies the behavior of the Enter key in PowerShell's console:
1. When you press Enter on an empty line, it automatically inserts `g st` (common shorthand for git status)
2. Then executes the command
```powershell
Set-PSReadLineKeyHandler -Key Enter -ScriptBlock {
$line = $null
$cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($line.Length -eq 0) {
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("g st")
}
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}
```