mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(wezterm): add wezterm config
This commit is contained in:
parent
8bb2d9fbe8
commit
baf0ee5255
7 changed files with 142 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -46,3 +46,5 @@ common/fzfrc
|
||||||
platforms/win/komorebi/applications.json
|
platforms/win/komorebi/applications.json
|
||||||
|
|
||||||
gitconfig
|
gitconfig
|
||||||
|
|
||||||
|
check_update
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,9 @@ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
|
||||||
# Set Environment Variables
|
# Set Environment Variables
|
||||||
# Use %PATH_EXT% to prevent PATH from being too long
|
# Use %PATH_EXT% to prevent PATH from being too long
|
||||||
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User")
|
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User")
|
||||||
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\citoy\AppData\Local\Cargo\bin", "User")
|
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\jsony\AppData\Local\Cargo\bin", "User")
|
||||||
[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\citoy\AppData\Local\Cargo\bin", "User")
|
[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\jsony\AppData\Local\Go\bin", "User")
|
||||||
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\citoy\AppData\Local\Cargo\bin", "User")
|
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\jsony\AppData\Local\Cargo\bin", "User")
|
||||||
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User")
|
|
||||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
|
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
if ($currentPath -notlike "*%PATH_EXT%*") {
|
if ($currentPath -notlike "*%PATH_EXT%*") {
|
||||||
$currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%"
|
$currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%"
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ function Invoke-Completion {
|
||||||
'git' { Import-Module Posh-Git }
|
'git' { Import-Module Posh-Git }
|
||||||
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
||||||
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
|
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
|
||||||
|
'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,18 @@
|
||||||
# Use XDG Base Directory Specification and its similar structure for Windows
|
# Use XDG Base Directory Specification and its similar structure for Windows
|
||||||
|
|
||||||
# wget
|
# wget
|
||||||
|
if (Get-Command wget -ErrorAction SilentlyContinue) {
|
||||||
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args}
|
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args}
|
||||||
|
}
|
||||||
|
|
||||||
# yarn v1
|
# yarn v1
|
||||||
|
if (Get-Command yarn -ErrorAction SilentlyContinue) {
|
||||||
${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args}
|
${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}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
Import-Module -Name Terminal-Icons
|
# Import-Module -Name Terminal-Icons
|
||||||
Import-Module -Name CompletionPredictor
|
Import-Module -Name CompletionPredictor
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
# Chocolatey
|
# Chocolatey
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# Use starship to set prompt
|
# Use starship to set prompt
|
||||||
$ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml"
|
$ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml"
|
||||||
|
|
||||||
# Invoke-Expression (&starship init powershell)
|
Invoke-Expression (&starship init powershell)
|
||||||
|
|
||||||
# Below is the backup of original prompt function
|
# Below is the backup of original prompt function
|
||||||
# $promptTime = $true
|
# $promptTime = $true
|
||||||
|
|
|
||||||
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