mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
Merge branch 'master' of github.com:js0ny/dotfiles
This commit is contained in:
commit
71c0e4be7b
26 changed files with 1795 additions and 262 deletions
|
|
@ -130,6 +130,7 @@ const _addSearchAlias = function (alias, name, searchUrl, searchPrefix = 's', ac
|
|||
api.addSearchAlias(alias, name, searchUrl, searchPrefix, acUrl, parseResponse);
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Keymap
|
||||
const mapLists = {
|
||||
/// scroll page
|
||||
|
|
@ -227,7 +228,6 @@ _addSearchAlias('br', 'Brew', 'https://duckduckgo.com/?q=!brew ')
|
|||
// #endregion
|
||||
|
||||
// #region Site-specific
|
||||
|
||||
// chatgpt.com
|
||||
api.unmap('t', /chatgpt.com/);
|
||||
api.mapkey('tn', 'New Chat', function () {
|
||||
|
|
@ -246,245 +246,28 @@ api.mapkey('S', 'Start/Stop Generating', function () {
|
|||
var btn = document.querySelector('button.h-8:nth-child(2)');
|
||||
btn.click();
|
||||
}, { domain: /chatgpt.com/ });
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
api.mapkey('an', 'New Chat', function () {
|
||||
var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)')
|
||||
btn.click();
|
||||
}, { domain: /chatgpt.com/ });
|
||||
api.mapkey('as', 'Start/Stop Generating', function () {
|
||||
var btn = document.querySelector('button.h-8:nth-child(2)');
|
||||
btn.click();
|
||||
}, { domain: /chatgpt.com/ });
|
||||
api.mapkey('as', 'Start/Stop Generating', function () {
|
||||
var btn = document.querySelector('button.h-8:nth-child(2)');
|
||||
btn.click();
|
||||
}, { domain: /chatgpt.com/ });
|
||||
//api.mapkey('tm', 'Toggle Model', function () {
|
||||
// var btn = document.querySelector('#radix -\: r2i\:');
|
||||
// btn.click();
|
||||
//}, { domain: /chatgpt.com/ });
|
||||
>>>>>>> 9557dcb023a49b72674bff74180d1d4224b959e0
|
||||
// perplexity.ai
|
||||
api.unmap('<Ctrl-i>', /perplexity.ai/);
|
||||
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Theme
|
||||
// reference to https://github.com/Foldex/surfingkeys-config
|
||||
// api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;');
|
||||
// api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text");
|
||||
// api.Visual.style('marks', 'background-color: #A3BE8C99;');
|
||||
// api.Visual.style('cursor', 'background-color: #88C0D0;');
|
||||
// settings.theme = `
|
||||
// fg: #E5E9F0;
|
||||
// bg: #3B4252;
|
||||
// bg-dark: #2E3440;
|
||||
// border: #4C566A;
|
||||
// main-fg: #88C0D0;
|
||||
// accent-fg: #A3BE8C;
|
||||
// info-fg: #5E81AC;
|
||||
// select: #4C566A;
|
||||
// /* ---------- Generic ---------- */
|
||||
// .sk_theme {
|
||||
// background: var(--bg);
|
||||
// color: var(--fg);
|
||||
// background-color: var(--bg);
|
||||
// border-color: var(--border);
|
||||
// font-family: var(--font);
|
||||
// font-size: var(--font-size);
|
||||
// font-weight: var(--font-weight);
|
||||
// }
|
||||
|
||||
// input {
|
||||
// font-family: var(--font);
|
||||
// font-weight: var(--font-weight);
|
||||
// }
|
||||
|
||||
// .sk_theme tbody {
|
||||
// color: var(--fg);
|
||||
// }
|
||||
|
||||
// .sk_theme input {
|
||||
// color: var(--fg);
|
||||
// }
|
||||
|
||||
// /* Hints */
|
||||
// #sk_hints .begin {
|
||||
// color: var(--accent-fg) !important;
|
||||
// }
|
||||
|
||||
// #sk_tabs .sk_tab {
|
||||
// background: var(--bg-dark);
|
||||
// border: 1px solid var(--border);
|
||||
// }
|
||||
|
||||
// #sk_tabs .sk_tab_title {
|
||||
// color: var(--fg);
|
||||
// }
|
||||
|
||||
// #sk_tabs .sk_tab_url {
|
||||
// color: var(--main-fg);
|
||||
// }
|
||||
|
||||
// #sk_tabs .sk_tab_hint {
|
||||
// background: var(--bg);
|
||||
// border: 1px solid var(--border);
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme #sk_frame {
|
||||
// background: var(--bg);
|
||||
// opacity: 0.2;
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// /* ---------- Omnibar ---------- */
|
||||
// /* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */
|
||||
// /* .sk_theme#sk_omnibar {
|
||||
// width: 100%;
|
||||
// left: 0;
|
||||
// } */
|
||||
|
||||
// .sk_theme .title {
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme .url {
|
||||
// color: var(--main-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme .annotation {
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme .omnibar_highlight {
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme .omnibar_timestamp {
|
||||
// color: var(--info-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme .omnibar_visitcount {
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
|
||||
// background: var(--bg-dark);
|
||||
// }
|
||||
|
||||
// .sk_theme #sk_omnibarSearchResult ul li.focused {
|
||||
// background: var(--border);
|
||||
// }
|
||||
|
||||
// .sk_theme #sk_omnibarSearchArea {
|
||||
// border-top-color: var(--border);
|
||||
// border-bottom-color: var(--border);
|
||||
// }
|
||||
|
||||
// .sk_theme #sk_omnibarSearchArea input,
|
||||
// .sk_theme #sk_omnibarSearchArea span {
|
||||
// font-size: var(--font-size);
|
||||
// }
|
||||
|
||||
// .sk_theme .separator {
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// /* ---------- Popup Notification Banner ---------- */
|
||||
// #sk_banner {
|
||||
// font-family: var(--font);
|
||||
// font-size: var(--font-size);
|
||||
// font-weight: var(--font-weight);
|
||||
// background: var(--bg);
|
||||
// border-color: var(--border);
|
||||
// color: var(--fg);
|
||||
// opacity: 0.9;
|
||||
// }
|
||||
|
||||
// /* ---------- Popup Keys ---------- */
|
||||
// #sk_keystroke {
|
||||
// background-color: var(--bg);
|
||||
// }
|
||||
|
||||
// .sk_theme kbd .candidates {
|
||||
// color: var(--info-fg);
|
||||
// }
|
||||
|
||||
// .sk_theme span.annotation {
|
||||
// color: var(--accent-fg);
|
||||
// }
|
||||
|
||||
// /* ---------- Popup Translation Bubble ---------- */
|
||||
// #sk_bubble {
|
||||
// background-color: var(--bg) !important;
|
||||
// color: var(--fg) !important;
|
||||
// border-color: var(--border) !important;
|
||||
// }
|
||||
|
||||
// #sk_bubble * {
|
||||
// color: var(--fg) !important;
|
||||
// }
|
||||
|
||||
// #sk_bubble div.sk_arrow div:nth-of-type(1) {
|
||||
// border-top-color: var(--border) !important;
|
||||
// border-bottom-color: var(--border) !important;
|
||||
// }
|
||||
|
||||
// #sk_bubble div.sk_arrow div:nth-of-type(2) {
|
||||
// border-top-color: var(--bg) !important;
|
||||
// border-bottom-color: var(--bg) !important;
|
||||
// }
|
||||
|
||||
// /* ---------- Search ---------- */
|
||||
// #sk_status,
|
||||
// #sk_find {
|
||||
// font-size: var(--font-size);
|
||||
// border-color: var(--border);
|
||||
// }
|
||||
|
||||
// .sk_theme kbd {
|
||||
// background: var(--bg-dark);
|
||||
// border-color: var(--border);
|
||||
// box-shadow: none;
|
||||
// color: var(--fg);
|
||||
// }
|
||||
|
||||
// .sk_theme .feature_name span {
|
||||
// color: var(--main-fg);
|
||||
// }
|
||||
|
||||
// /* ---------- ACE Editor ---------- */
|
||||
// #sk_editor {
|
||||
// background: var(--bg-dark) !important;
|
||||
// height: 50% !important;
|
||||
// /* Remove this to restore the default editor size */
|
||||
// }
|
||||
|
||||
// .ace_dialog-bottom {
|
||||
// border-top: 1px solid var(--bg) !important;
|
||||
// }
|
||||
|
||||
// .ace-chrome .ace_print-margin,
|
||||
// .ace_gutter,
|
||||
// .ace_gutter-cell,
|
||||
// .ace_dialog {
|
||||
// background: var(--bg) !important;
|
||||
// }
|
||||
|
||||
// .ace-chrome {
|
||||
// color: var(--fg) !important;
|
||||
// }
|
||||
|
||||
// .ace_gutter,
|
||||
// .ace_dialog {
|
||||
// color: var(--fg) !important;
|
||||
// }
|
||||
|
||||
// .ace_cursor {
|
||||
// color: var(--fg) !important;
|
||||
// }
|
||||
|
||||
// .normal-mode .ace_cursor {
|
||||
// background-color: var(--fg) !important;
|
||||
// border: var(--fg) !important;
|
||||
// opacity: 0.7 !important;
|
||||
// }
|
||||
|
||||
// .ace_marker-layer .ace_selection {
|
||||
// background: var(--select) !important;
|
||||
// }
|
||||
|
||||
// .ace_editor,
|
||||
// .ace_dialog span,
|
||||
// .ace_dialog input {
|
||||
// font-family: var(--font);
|
||||
// font-size: var(--font-size);
|
||||
// font-weight: var(--font-weight);
|
||||
// }`;
|
||||
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>
|
||||
// #endregion
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
}
|
||||
|
|
|
|||
42
tools/powershell/Completions.ps1
Normal file
42
tools/powershell/Completions.ps1
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
function Invoke-Completion {
|
||||
param ([string]$command)
|
||||
switch ($command) {
|
||||
'docker' { docker completion powershell | Out-String | Invoke-Expression }
|
||||
'dotnet' {
|
||||
# https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#powershell
|
||||
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
dotnet complete --position $cursorPosition "$commandAst" | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||
}
|
||||
}
|
||||
}
|
||||
'git' { Import-Module Posh-Git }
|
||||
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
||||
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
|
||||
'rg' { rg --generate complete-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', 'dotnet', 'git', 'hugo', 'pip', 'rg', 'uv', 'wezterm', 'winget')
|
||||
|
||||
$cmds | Where-Object { $_ -like "$wordToComplete*" }
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
# Use XDG Base Directory Specification and its similar structure for Windows
|
||||
|
||||
# wget
|
||||
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args}
|
||||
|
||||
# yarn v1
|
||||
${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args}
|
||||
if ($Env:WEZTERM) {
|
||||
# Environment variable injected by wezterm/wezterm.lua
|
||||
${function:icat} = { wezterm imgcat $args }
|
||||
}
|
||||
elseif ($Env:KITTY) {
|
||||
${function:icat} = { kitty +kitten icat $args }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Import-Module -Name Terminal-Icons
|
||||
# Import-Module -Name Terminal-Icons
|
||||
Import-Module -Name CompletionPredictor
|
||||
if ($IsWindows) {
|
||||
# Chocolatey
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
```
|
||||
|
|
|
|||
121
tools/wezterm/wezterm.lua
Normal file
121
tools/wezterm/wezterm.lua
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
-- $DOTFILES/tools\wezterm\wezterm.lua
|
||||
-- Date: 2024-12-22
|
||||
-- Author: js0ny
|
||||
|
||||
-- Location:
|
||||
-- $XDG_CONFIG_HOME/wezterm/wezterm.lua
|
||||
-- Linking:
|
||||
-- ln -sf $DOTFILES/tools/wezterm/wezterm.lua $XDG_CONFIG_HOME/wezterm/wezterm.lua
|
||||
|
||||
local wezterm = require 'wezterm'
|
||||
|
||||
local config = {}
|
||||
|
||||
local os_type = ""
|
||||
if package.config:sub(1,1) == "\\" then
|
||||
-- Windows
|
||||
os_type = "Windows"
|
||||
elseif package.config:sub(1,1) == "/" then
|
||||
-- Unix-like (Linux, macOS, etc.)
|
||||
if os.getenv("HOME") then
|
||||
os_type = "Unix-like"
|
||||
-- You can differentiate further by checking for macOS or Linux if needed
|
||||
if os.getenv("XDG_SESSION_TYPE") then
|
||||
-- Likely Linux
|
||||
os_type = "Linux"
|
||||
elseif os.execute("uname -s | grep -i darwin") == 0 then
|
||||
-- macOS
|
||||
os_type = "macOS"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print("[DEBUG] Detected OS: " .. os_type)
|
||||
|
||||
|
||||
-- Appearance
|
||||
------------------
|
||||
-- Font and color scheme
|
||||
config.font = wezterm.font("FiraCode Nerd Font")
|
||||
config.color_scheme = "Ayu Mirage"
|
||||
config.font_size = 12.0
|
||||
if os_type == "Windows" then
|
||||
config.window_background_opacity = 0.7
|
||||
config.win32_system_backdrop = 'Acrylic'
|
||||
end
|
||||
-- Tab appearance
|
||||
config.hide_tab_bar_if_only_one_tab = true
|
||||
config.tab_bar_at_bottom = true
|
||||
|
||||
-- Keybindings
|
||||
------------------
|
||||
config.leader = { key="q", mods="CTRL" }
|
||||
config.keys = {
|
||||
{
|
||||
key = 'q',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.SendKey {key = 'q', mods = 'CTRL'},
|
||||
},
|
||||
-- Windows Management
|
||||
{
|
||||
key = '|',
|
||||
mods = 'LEADER|SHIFT',
|
||||
action = wezterm.action.SplitHorizontal{domain="CurrentPaneDomain"}
|
||||
},
|
||||
{
|
||||
key = '-',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.SplitVertical{domain="CurrentPaneDomain"}
|
||||
},
|
||||
{
|
||||
key = 'h',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.ActivatePaneDirection 'Left'
|
||||
},
|
||||
{
|
||||
key = 'n',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.ActivatePaneDirection 'Down'
|
||||
},
|
||||
{
|
||||
key = 'e',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.ActivatePaneDirection 'Up'
|
||||
},
|
||||
{
|
||||
key = 'i',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.ActivatePaneDirection 'Right'
|
||||
},
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.AdjustPaneSize { 'Left', 5 },
|
||||
},
|
||||
{
|
||||
key = 'N',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.AdjustPaneSize { 'Down', 5 },
|
||||
},
|
||||
{
|
||||
key = 'E',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.AdjustPaneSize { 'Up', 5 },
|
||||
},
|
||||
{
|
||||
key = 'I',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.AdjustPaneSize { 'Right', 5 },
|
||||
},
|
||||
}
|
||||
-- Environment
|
||||
------------------
|
||||
if os_type == "Windows" then
|
||||
config.default_prog = { "pwsh.exe" }
|
||||
else
|
||||
config.default_prog = { "fish" }
|
||||
end
|
||||
config.set_environment_variables = {
|
||||
WEZTERM="true",
|
||||
}
|
||||
return config
|
||||
Loading…
Add table
Add a link
Reference in a new issue