Skip to content

Commit

Permalink
docs: improve readme (#13)
Browse files Browse the repository at this point in the history
* Improved readme with a glossary of key bindings
* Fixed SUPER+SUPER_REV key assignment for linux
  • Loading branch information
KevinSilvester authored Mar 31, 2024
1 parent a51a976 commit 31c49f4
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 27 deletions.
193 changes: 192 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,199 @@
# My WezTerm Config

<p align="center">
<a href="https://github.com/KevinSilvester/wezterm-config/stargazers">
<img alt="Stargazers" src="https://img.shields.io/github/stars/KevinSilvester/wezterm-config?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41">
</a>
<a href="https://github.com/KevinSilvester/wezterm-config/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/KevinSilvester/wezterm-config?style=for-the-badge&logo=gitbook&color=B5E8E0&logoColor=D9E0EE&labelColor=302D41">
</a>
<a href="https://github.com/KevinSilvester/wezterm-config/actions/workflows/lint.yml">
<img alt="Build" src="https://img.shields.io/github/actions/workflow/status/KevinSilvester/wezterm-config/lint.yml?&style=for-the-badge&logo=githubactions&color=A6E3A1&logoColor=D9E0EE&labelColor=302D41">
</a>
</p>

![screenshot](./.github/screenshots/wezterm.gif)

### References/Links
&nbsp;

### Features

- [**Background Image Selector**](https://github.com/KevinSilvester/wezterm-config/blob/master/utils/backdrops.lua)

Uses `wezterm.read_dir` to scan the `backdrops` directory for images.

> See: [key bindings](#background-images) for usage
- [**GPU Adapter Selector**](https://github.com/KevinSilvester/wezterm-config/blob/master/utils/gpu_adapter.lua)

> :bulb: Only works if the [`front_end`](https://github.com/KevinSilvester/wezterm-config/blob/master/config/appearance.lua#L8) option is set to `WebGpu`.
A small utility to select the best GPU + Adapter (graphics API) combo for your machine.

GPU + Adapter combo is selected based on the following criteria:

1. <details>
<summary>Best GPU available</summary>

(`Discrete` > `Integrated` > `Other` (for `wgpu`'s OpenGl implementation on Discrete GPU) > `Cpu`)
</details>

2. <details>
<summary>Best graphics API available (based off my very scientific scroll a big log file in Neovim test 😁)</summary>

> see: <https://github.com/gfx-rs/wgpu#supported-platforms> for more info
- Windows: `Dx12` > `Vulkan` > `OpenGl`
- Linux: `Vulkan` > `OpenGl`
- Mac: `Metal`

</details>

&nbsp;

### All Key Binbdings

Most of the key bindings revolve around a <kbd>SUPER</kbd> and a <kbd>SUPER_REV</kbd>(super reversed) keys.<br>

- On MacOs:
- <kbd>SUPER</kbd> ⇨ <kbd>Super</kbd>
- <kbd>SUPER_REV</kbd> ⇨ <kbd>Super</kbd>+<kbd>Ctrl</kbd>
- On Windows and Linux
- <kbd>SUPER</kbd> ⇨ <kbd>Alt</kbd>
- <kbd>SUPER_REV</kbd> ⇨ <kbd>Alt</kbd>+<kbd>Ctrl</kbd>

> To avoid confusion when switching between different OS and to avoid conflicting<br>
> with OS's built-in keyboard shortcuts.
- On all platforms: <kbd>LEADER</kbd> ⇨ <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Space</kbd>

#### Miscellaneous/Useful

| Keys | Action |
| ----------------------------- | ------------------------------------------- |
| <kbd>F1</kbd> | `ActivateCopyMode` |
| <kbd>F2</kbd> | `ActivateCommandPalette` |
| <kbd>F3</kbd> | `ShowLauncher` |
| <kbd>F4</kbd> | `ShowLauncher` <sub>(tabs only)</sub> |
| <kbd>F5</kbd> | `ShowLauncher` <sub>(workspaces only)</sub> |
| <kbd>F11</kbd> | `ToggleFullScreen` |
| <kbd>F12</kbd> | `ShowDebugOverlay` |
| <kbd>SUPER</kbd>+<kbd>f</kbd> | Search Text |
| <kbd>SUPER</kbd>+<kbd>f</kbd> | Open URL |

&nbsp;

#### Copy+Paste

| Keys | Action |
| --------------------------------------------- | -------------------- |
| <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>c</kbd> | Copy to Clipborad |
| <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> | Paste from Clipborad |

&nbsp;

#### Tabs

##### Tabs: Spawn+Close

| Keys | Action |
| --------------------------------- | ------------------------------------- |
| <kbd>SUPER</kbd>+<kbd>t</kbd> | `SpawnTab` <sub>(DefaultDomain)</sub> |
| <kbd>SUPER_REV</kbd>+<kbd>f</kbd> | `SpawnTab` <sub>(WSL:Ubuntu)</sub> |
| <kbd>SUPER_REV</kbd>+<kbd>w</kbd> | `CloseCurrentTab` |

##### Tabs: Navigation

| Keys | Action |
| --------------------------------- | -------------- |
| <kbd>SUPER</kbd>+<kbd>[</kbd> | Next Tab |
| <kbd>SUPER</kbd>+<kbd>]</kbd> | Previous Tab |
| <kbd>SUPER_REV</kbd>+<kbd>[</kbd> | Move Tab Left |
| <kbd>SUPER_REV</kbd>+<kbd>]</kbd> | Move Tab Right |

&nbsp;

#### Windows

| Keys | Action |
| ----------------------------- | ------------- |
| <kbd>SUPER</kbd>+<kbd>n</kbd> | `SpawnWindow` |

&nbsp;

#### Panes

##### Panes: Split Panes

| Keys | Action |
| ---------------------------------- | ------------------------------------------------ |
| <kbd>SUPER</kbd>+<kbd>\\</kbd> | `SplitVertical` <sub>(CurrentPaneDomain)</sub> |
| <kbd>SUPER_REV</kbd>+<kbd>\\</kbd> | `SplitHorizontal` <sub>(CurrentPaneDomain)</sub> |

##### Panes: Zoom+Close Pane

| Keys | Action |
| --------------------------------- | --------------------- |
| <kbd>SUPER</kbd>+<kbd>Enter</kbd> | `TogglePaneZoomState` |
| <kbd>SUPER</kbd>+<kbd>w</kbd> | `CloseCurrentPane` |

##### Panes: Navigation

| Keys | Action |
| --------------------------------- | ----------------------- |
| <kbd>SUPER_REV</kbd>+<kbd>k</kbd> | Move to Pane (Up) |
| <kbd>SUPER_REV</kbd>+<kbd>j</kbd> | Move to Pane (Down) |
| <kbd>SUPER_REV</kbd>+<kbd>h</kbd> | Move to Pane (Left) |
| <kbd>SUPER_REV</kbd>+<kbd>l</kbd> | Move to Pane (Right) |
| <kbd>SUPER_REV</kbd>+<kbd>p</kbd> | Swap with selected Pane |

&nbsp;

#### Background Images

| Keys | Action |
| --------------------------------- | ----------------------- |
| <kbd>SUPER</kbd>+<kbd>/</kbd> | Select Random Image |
| <kbd>SUPER</kbd>+<kbd>,</kbd> | Cycle to next Image |
| <kbd>SUPER</kbd>+<kbd>.</kbd> | Cycle to previous Image |
| <kbd>SUPER_REV</kbd>+<kbd>/</kbd> | Fuzzy select Image |

&nbsp;

#### Key Tables

> See: <https://wezfurlong.org/wezterm/config/key-tables.html>
| Keys | Action |
| ------------------------------ | ------------- |
| <kbd>LEADER</kbd>+<kbd>f</kbd> | `resize_font` |
| <kbd>LEADER</kbd>+<kbd>p</kbd> | `resize_pane` |

##### Key Table: `resize_font`

| Keys | Action |
| -------------- | ------------------------------- |
| <kbd>k</kbd> | `IncreaseFontSize` |
| <kbd>j</kbd> | `DecreaseFontSize` |
| <kbd>r</kbd> | `ResetFontSize` |
| <kbd>q</kbd> | `PopKeyTable` <sub>(exit)</sub> |
| <kbd>Esc</kbd> | `PopKeyTable` <sub>(exit)</sub> |

##### Key Table: `resize_pane`

| Keys | Action |
| -------------- | ---------------------------------------------- |
| <kbd>k</kbd> | `AdjustPaneSize` <sub>(Direction: Up)</sub> |
| <kbd>j</kbd> | `AdjustPaneSize` <sub>(Direction: Down)</sub> |
| <kbd>h</kbd> | `AdjustPaneSize` <sub>(Direction: Left)</sub> |
| <kbd>l</kbd> | `AdjustPaneSize` <sub>(Direction: Right)</sub> |
| <kbd>q</kbd> | `PopKeyTable` <sub>(exit)</sub> |
| <kbd>Esc</kbd> | `PopKeyTable` <sub>(exit)</sub> |

&nbsp;

### References/Inspirations

- <https://github.com/rxi/lume>
- <https://github.com/catppuccin/wezterm>
- <https://github.com/wez/wezterm/discussions/628#discussioncomment-1874614>
Expand Down
54 changes: 28 additions & 26 deletions config/bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ local act = wezterm.action

local mod = {}

if platform.is_mac or platform.is_linux then
if platform.is_mac then
mod.SUPER = 'SUPER'
mod.SUPER_REV = 'SUPER|CTRL'
elseif platform.is_win then
elseif platform.is_win or platform.is_linux then
mod.SUPER = 'ALT' -- to not conflict with Windows key shortcuts
mod.SUPER_REV = 'ALT|CTRL'
end

-- stylua: ignore
local keys = {
-- misc/useful --
{ key = 'F1', mods = 'NONE', action = 'ActivateCopyMode' },
Expand All @@ -25,9 +26,9 @@ local keys = {
action = act.ShowLauncherArgs({ flags = 'FUZZY|WORKSPACES' }),
},
-- toggle fullscreen
{ key = 'F11', mods = 'NONE', action = act.ToggleFullScreen },
{ key = 'F12', mods = 'NONE', action = act.ShowDebugOverlay },
{ key = 'f', mods = mod.SUPER, action = act.Search({ CaseInSensitiveString = '' }) },
{ key = 'F11', mods = 'NONE', action = act.ToggleFullScreen },
{ key = 'F12', mods = 'NONE', action = act.ShowDebugOverlay },
{ key = 'f', mods = mod.SUPER, action = act.Search({ CaseInSensitiveString = '' }) },
{
key = 'u',
mods = mod.SUPER,
Expand All @@ -45,24 +46,24 @@ local keys = {
},

-- copy/paste --
{ key = 'c', mods = 'CTRL|SHIFT', action = act.CopyTo('Clipboard') },
{ key = 'v', mods = 'CTRL|SHIFT', action = act.PasteFrom('Clipboard') },
{ key = 'c', mods = 'CTRL|SHIFT', action = act.CopyTo('Clipboard') },
{ key = 'v', mods = 'CTRL|SHIFT', action = act.PasteFrom('Clipboard') },

-- tabs --
-- tabs: spawn+close
{ key = 't', mods = mod.SUPER, action = act.SpawnTab('DefaultDomain') },
{ key = 't', mods = mod.SUPER, action = act.SpawnTab('DefaultDomain') },
{ key = 't', mods = mod.SUPER_REV, action = act.SpawnTab({ DomainName = 'WSL:Ubuntu' }) },
{ key = 'w', mods = mod.SUPER_REV, action = act.CloseCurrentTab({ confirm = false }) },

-- tabs: navigation
{ key = '[', mods = mod.SUPER, action = act.ActivateTabRelative(-1) },
{ key = ']', mods = mod.SUPER, action = act.ActivateTabRelative(1) },
{ key = '[', mods = mod.SUPER, action = act.ActivateTabRelative(-1) },
{ key = ']', mods = mod.SUPER, action = act.ActivateTabRelative(1) },
{ key = '[', mods = mod.SUPER_REV, action = act.MoveTabRelative(-1) },
{ key = ']', mods = mod.SUPER_REV, action = act.MoveTabRelative(1) },

-- window --
-- spawn windows
{ key = 'n', mods = mod.SUPER, action = act.SpawnWindow },
{ key = 'n', mods = mod.SUPER, action = act.SpawnWindow },

-- background controls --
{
Expand Down Expand Up @@ -115,14 +116,14 @@ local keys = {
},

-- panes: zoom+close pane
{ key = 'Enter', mods = mod.SUPER, action = act.TogglePaneZoomState },
{ key = 'w', mods = mod.SUPER, action = act.CloseCurrentPane({ confirm = false }) },
{ key = 'Enter', mods = mod.SUPER, action = act.TogglePaneZoomState },
{ key = 'w', mods = mod.SUPER, action = act.CloseCurrentPane({ confirm = false }) },

-- panes: navigation
{ key = 'k', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Up') },
{ key = 'j', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Down') },
{ key = 'h', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Left') },
{ key = 'l', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Right') },
{ key = 'k', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Up') },
{ key = 'j', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Down') },
{ key = 'h', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Left') },
{ key = 'l', mods = mod.SUPER_REV, action = act.ActivatePaneDirection('Right') },
{
key = 'p',
mods = mod.SUPER_REV,
Expand Down Expand Up @@ -152,21 +153,22 @@ local keys = {
},
}

-- stylua: ignore
local key_tables = {
resize_font = {
{ key = 'k', action = act.IncreaseFontSize },
{ key = 'j', action = act.DecreaseFontSize },
{ key = 'r', action = act.ResetFontSize },
{ key = 'k', action = act.IncreaseFontSize },
{ key = 'j', action = act.DecreaseFontSize },
{ key = 'r', action = act.ResetFontSize },
{ key = 'Escape', action = 'PopKeyTable' },
{ key = 'q', action = 'PopKeyTable' },
{ key = 'q', action = 'PopKeyTable' },
},
resize_pane = {
{ key = 'k', action = act.AdjustPaneSize({ 'Up', 1 }) },
{ key = 'j', action = act.AdjustPaneSize({ 'Down', 1 }) },
{ key = 'h', action = act.AdjustPaneSize({ 'Left', 1 }) },
{ key = 'l', action = act.AdjustPaneSize({ 'Right', 1 }) },
{ key = 'k', action = act.AdjustPaneSize({ 'Up', 1 }) },
{ key = 'j', action = act.AdjustPaneSize({ 'Down', 1 }) },
{ key = 'h', action = act.AdjustPaneSize({ 'Left', 1 }) },
{ key = 'l', action = act.AdjustPaneSize({ 'Right', 1 }) },
{ key = 'Escape', action = 'PopKeyTable' },
{ key = 'q', action = 'PopKeyTable' },
{ key = 'q', action = 'PopKeyTable' },
},
}

Expand Down

0 comments on commit 31c49f4

Please sign in to comment.