mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
Add lazygit keybindings
This commit is contained in:
parent
baf0ee5255
commit
4657765e21
6 changed files with 652 additions and 3 deletions
|
|
@ -1,62 +0,0 @@
|
|||
// ~\.config\fastfetch\config.jsonc
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
// "type": "auto",
|
||||
"source": "Windows 7",
|
||||
"padding": {
|
||||
"top": 2,
|
||||
"left": 1,
|
||||
"right": 2
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"multithreading": true
|
||||
},
|
||||
"display": {
|
||||
"separator": " ",
|
||||
"key": {
|
||||
"width": 10,
|
||||
"paddingLeft": 2,
|
||||
"type": "icon"
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "title",
|
||||
"format": "{#1}───────────── {#}{user-name-colored}@{host-name-colored}"
|
||||
},
|
||||
{
|
||||
"type": "colors",
|
||||
"symbol": "diamond",
|
||||
"paddingLeft": 15
|
||||
},
|
||||
"os",
|
||||
"host",
|
||||
"kernel",
|
||||
"uptime",
|
||||
{
|
||||
"type": "packages"
|
||||
},
|
||||
"shell",
|
||||
"display",
|
||||
"de",
|
||||
"wm",
|
||||
"wmtheme",
|
||||
"theme",
|
||||
"icons",
|
||||
"font",
|
||||
"cursor",
|
||||
"terminal",
|
||||
"terminalfont",
|
||||
"cpu",
|
||||
"gpu",
|
||||
"memory",
|
||||
"swap",
|
||||
"disk",
|
||||
"localip",
|
||||
"battery",
|
||||
"poweradapter",
|
||||
"locale"
|
||||
]
|
||||
}
|
||||
|
|
@ -31,5 +31,6 @@ Set-Alias "py" "python"
|
|||
Set-Alias "ipy" "ipython"
|
||||
|
||||
if ($isWindows) {
|
||||
function kex { wsl -d kali-linux kex --sl -s }
|
||||
# Debugging
|
||||
# function kex { wsl -d kali-linux kex --sl -s }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,28 @@ function Invoke-Completion {
|
|||
'git' { Import-Module Posh-Git }
|
||||
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
||||
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
|
||||
'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression }
|
||||
'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression }
|
||||
'winget' {
|
||||
# https://learn.microsoft.com/en-us/windows/package-manager/winget/tab-completion
|
||||
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||
$Local:word = $wordToComplete.Replace('"', '""')
|
||||
$Local:ast = $commandAst.ToString().Replace('"', '""')
|
||||
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Set-Alias "icmp" "Invoke-Completion"
|
||||
|
||||
Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock {
|
||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
|
||||
|
||||
$cmds = @('docker', 'git', 'hugo', 'pip', 'uv', 'wezterm', 'winget')
|
||||
|
||||
$cmds | Where-Object { $_ -like "$wordToComplete*" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command
|
|||
Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory
|
||||
|
||||
## Use <Tab> to Invoke MenuComplete
|
||||
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
|
||||
|
|
|
|||
|
|
@ -20,3 +20,20 @@ This is the cross-platform PowerShell profile for PowerShell Core
|
|||
| `^a` | To Beginning of Line | All |
|
||||
| `^e` | To End of Line | All |
|
||||
| `^[` | To Normal Mode | Insert |
|
||||
|
||||
## `Get-Command` vs `which.exe` under Windows
|
||||
|
||||
```powershell
|
||||
PS > hyperfine "pwsh.exe -NoProfile -Command 'Get-Command which'" "pwsh.exe -NoProfile -Command 'which which'" --warmup 10
|
||||
Benchmark 1: pwsh.exe -NoProfile -Command 'Get-Command which'
|
||||
Time (mean ± σ): 152.1 ms ± 1.3 ms [User: 112.2 ms, System: 89.3 ms]
|
||||
Range (min … max): 150.0 ms … 155.3 ms 18 runs
|
||||
|
||||
Benchmark 2: pwsh.exe -NoProfile -Command 'which which'
|
||||
Time (mean ± σ): 153.7 ms ± 6.4 ms [User: 126.7 ms, System: 101.9 ms]
|
||||
Range (min … max): 147.8 ms … 169.5 ms 19 runs
|
||||
|
||||
Summary
|
||||
pwsh.exe -NoProfile -Command 'Get-Command which' ran
|
||||
1.01 ± 0.04 times faster than pwsh.exe -NoProfile -Command 'which which'
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue