Skip to content

Commit 425b374

Browse files
committed
fix: Further polish of Config, plus some tweaks for HyperlinkRule.
Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent e3951bf commit 425b374

2 files changed

Lines changed: 131 additions & 39 deletions

File tree

lua/types/config/init.lua

Lines changed: 128 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@
286286
-- otherwise attempt to execute the response.
287287
-- <https://marc.info/?l=bugtraq&m=104612710031920&w=2>
288288
---@field enable_title_reporting? bool
289+
-- If `false`, do not try to use a Wayland protocol connection
290+
-- when starting the gui frontend, and instead use X11.
291+
--
292+
-- This option is only considered on X11/Wayland systems and
293+
-- has no effect on macOS or Windows.
294+
--
295+
-- The default is `true`
296+
---@field enable_wayland? bool
289297
---@field exec_domains? ExecDomain[]
290298
---@field exit_behavior? ExitBehavior
291299
---@field exit_behavior_messaging? ExitBehaviorMessaging
@@ -364,7 +372,12 @@
364372
-- - Vulkan
365373
-- - DirectX 12 (on Windows)
366374
---@field front_end? FrontEndSelection
375+
-- When `config.font_shaper = "Harfbuzz"`, this setting affects
376+
-- how font shaping takes place.
377+
--
378+
-- See [Font Shaping](https://wezterm.org/config/font-shaping.html) for more information and examples
367379
---@field harfbuzz_features? HarfbuzzFeatures[]
380+
-- Defines rules to match text from the terminal output and generate clickable links
368381
---@field hyperlink_rules? HyperlinkRule[]
369382
-- Specifies the width of a new window, expressed in character cells
370383
---@field initial_cols? u16
@@ -376,10 +389,57 @@
376389
-- This can be used to produce a translucent window effect rather than
377390
-- a crystal clear transparent window effect
378391
---@field kde_window_background_blur? bool
392+
-- Controls how keys without an explicit phys: or mapped: prefix are treated.
393+
--
394+
-- If `config.key_map_preference = "Mapped"` (the default), then `mapped:`
395+
-- is assumed.
396+
-- If `config.key_map_preference = "Physical"` then `phys:` is assumed.
397+
--
398+
-- Default key assignments also respect `key_map_preference`
399+
---@field key_map_preference? KeyMapPreference
400+
-- See the main [Key Tables](https://wezterm.org/config/key-tables.html) docs!
379401
---@field key_tables? table<string, Key[]>
380402
---@field keys? Key[]
381-
---@field launcher_alphabet? string
382-
---@field leader? LeaderKey
403+
-- Specify a string of unique characters.
404+
--
405+
-- The characters in the string are used to calculate one or two key press
406+
-- shortcuts that can be used to quickly choose from the Launcher when in the default mode.
407+
--
408+
-- Defaults to: `"1234567890abcdefghilmnopqrstuvwxyz"`.
409+
-- (Without j/k so they can be used for movement up and down)
410+
---@field launcher_alphabet? string|"1234567890abcdefghilmnopqrstuvwxyz"
411+
-- You can define your own entries for the [Launcher Menu](https://wezterm.org/config/launch.html#the-launcher-menu)
412+
-- using this configuration setting.
413+
--
414+
-- Each entry in `launch_menu` is an instance of a `SpawnCommand` object
415+
---@field launch_menu? SpawnCommand[]
416+
-- Scales the computed line height to adjust the spacing between successive rows of text.
417+
--
418+
-- The default line height is controlled by the font_size configuration option.
419+
-- If you feel that your chosen font feels too vertically cramped then you can set
420+
-- `config.line_height = 1.2` to increase the vertical spacing by 20%.
421+
-- Conversely, setting `config.line_height = 0.9` will decrease the vertical spacing by 10%
422+
---@field line_height? number
423+
-- When set to `true`, WezTerm will log warnings when it receives escape sequences
424+
-- which it does not understand.
425+
-- Those warnings are harmless and are useful primarily by the maintainer
426+
-- to discover new and interesting escape sequences.
427+
--
428+
-- In previous versions, there was no option to control this, and WezTerm would always
429+
-- log warnings for unknown escape sequences
430+
---@field log_unknown_escape_sequences? bool
431+
-- On macOS systems, this option controls whether modified key presses are routed
432+
-- via the IME when `use_ime = true`.
433+
--
434+
-- When processing a key event, if any modifiers are held,
435+
-- if the modifiers intersect with the value of macos_forward_to_ime_modifier_mask,
436+
-- then the key event is routed to the IME,
437+
-- which may choose to swallow the key event as part of its own state management.
438+
--
439+
-- Users of a Japanese IME may wish to set this to `"SHIFT|CTRL"`,
440+
-- but should note that it will prevent certain `CTRL` key combinations
441+
-- that are commonly used in unix terminal programs from working as expected
442+
---@field macos_forward_to_ime_modifier_mask? Modifiers
383443
-- When `true` and in full screen mode,
384444
-- the window will extend behind the notch on macOS.
385445
--
@@ -401,8 +461,27 @@
401461
-- config.macos_fullscreen_extend_behind_notch = true
402462
-- ```
403463
---@field macos_fullscreen_extend_behind_notch? bool
464+
---@field mouse_bindings? MouseBindingBase[]
404465
---@field mux_enable_ssh_agent? bool
405466
---@field mux_env_remove? string[]
467+
-- When set to `true`, contiguous runs codepoints output to the terminal
468+
-- are normalized to Unicode Normalization Form C (NFC).
469+
--
470+
-- This can improve the display of text and in the terminal
471+
-- when portions of the output are in other normalization forms,
472+
-- particularly with Korean text where
473+
-- a given glyph can be comprised of several codepoints.
474+
--
475+
-- However, depending on the application running inside the terminal,
476+
-- enabling this option may introduce discrepancies in the understanding of text positioning:
477+
-- while it may fix some display glitches for some applications,
478+
-- it may trade them for other glitches.
479+
--
480+
-- As such, you should consider this configuration setting to be an imperfect option!
481+
--
482+
-- This option defaults to `false` as it introduces some additional text processing
483+
-- that is not necessary for most users
484+
---@field normalize_output_to_unicode_nfc? bool
406485
-- This option controls how wezterm behaves when a toast notification escape sequence is received.
407486
--
408487
-- The following escape sequences will generate a toast notification:
@@ -430,6 +509,42 @@
430509
-- config.pane_select_font = wezterm.font 'Roboto'
431510
-- ```
432511
---@field pane_select_font? Fonts|FontAttributes|FontFamilyAttributes
512+
-- Specify the alphabet used to produce labels for the items matched in quick select mode.
513+
--
514+
-- The default alphabet is `"asdfqwerzxcvjklmiuopghtybn"` which means that
515+
-- the first matching item from the bottom is labelled with an `a`,
516+
-- the second with `s` and so forth;
517+
-- these are easily accessible characters in a `qwerty` keyboard layout.
518+
--
519+
-- |----------|----------------------------------------|
520+
-- | `qwerty` | `"asdfqwerzxcvjklmiuopghtybn"` (default) |
521+
-- | `qwertz` | `"asdfqweryxcvjkluiopmghtzbn"` |
522+
-- | `azerty` | `"qsdfazerwxcvjklmuiopghtybn"` |
523+
-- | `dvorak` | `"aoeuqjkxpyhtnsgcrlmwvzfidb"` |
524+
-- | `colemak` | `"arstqwfpzxcvneioluymdhgjbk"` |
525+
--
526+
-- The suggested alphabet in the above table uses the left 4 fingers
527+
-- on the home row, top row, bottom row, then the right 4 fingers
528+
-- on the home raw, top row, bottom row, followed by the characters
529+
-- in the middle of the keyboard that may be harder to reach
530+
---@field quick_select_alphabet? string
531+
-- Specify additional patterns to match when in quick select mode.
532+
--
533+
-- This setting is a table listing out a set of regular expressions.
534+
--
535+
-- ```lua
536+
-- config.quick_select_patterns = {
537+
-- -- match things that look like sha1 hashes
538+
-- -- (this is actually one of the default patterns)
539+
-- '[0-9a-f]{7,40}',
540+
-- }
541+
-- ```
542+
--
543+
-- The regex syntax now supports backreferences and look around assertions.
544+
-- See [Fancy Regex Syntax](https://docs.rs/fancy-regex/latest/fancy_regex/#syntax) for the extended syntax,
545+
-- which builds atop the underlying [Regex syntax](https://docs.rs/regex/latest/regex/#syntax).
546+
-- In prior versions, only the base Regex syntax was supported
547+
---@field quick_select_patterns? string[]
433548
-- When set to `true`, all color and styling is removed from the pane
434549
-- prior to performing matching and highlighting any matching text
435550
-- in quick select mode.
@@ -495,8 +610,18 @@
495610
---@field text_min_contrast_ratio? number|nil
496611
---@field tls_clients? TlsDomainClient[]
497612
---@field tls_servers? TlsDomainServer[]
613+
-- If you are using a layout with an `AltGr` key, you may experience issues
614+
-- when running inside a VNC session, because VNC emulates the `AltGr` keypresses
615+
-- by sending plain `Ctrl-Alt` keys, which won't be understood as `AltGr`.
616+
--
617+
-- To fix this behavior you can tell WezTerm to treat left `Ctrl-Alt` keys as `AltGr`
618+
-- with the option `treat_left_ctrlalt_as_altgr`.
619+
--
620+
-- Note that the key bindings using separate `Ctrl` and `Alt` won't be triggered anymore
621+
---@field treat_left_ctrlalt_as_altgr? bool
498622
-- The set of unix domains
499623
---@field unix_domains? UnixDomain[]
624+
---@field use_ime? bool
500625
---@field webgpu_force_fallback_adapter? bool
501626
-- Whether to select the higher powered discrete GPU when
502627
-- the system has a choice of integrated or discrete.
@@ -513,46 +638,19 @@
513638
---@field window_content_alignment? ContentAlignment
514639
---@field window_frame? WindowFrameConfig
515640
---@field wsl_domains? WslDomain[]
516-
---@field macos_forward_to_ime_modifier_mask? Modifiers
517-
---@field mouse_bindings? MouseBindingBase[]
518-
---@field normalize_output_to_unicode_nfc? bool
519-
---@field quick_select_alphabet? string
520-
---@field quick_select_patterns? string[]
521-
---@field send_composed_key_when_left_alt_is_pressed? bool
522-
---@field send_composed_key_when_right_alt_is_pressed? bool
523-
---@field treat_left_ctrlalt_as_altgr? bool
524-
-- If true, display the tab bar UI at the top of the window.
525-
-- The tab bar shows the titles of the tabs and which is the
526-
-- active tab. Clicking on a tab activates it.
641+
---@field xim_im_name? string
527642
---@field enable_tab_bar? bool
528643
---@field use_fancy_tab_bar? bool
529644
---@field tab_bar_at_bottom? bool
530645
---@field mouse_wheel_scrolls_tabs? bool
531-
-- If true, tab bar titles are prefixed with the tab index
532646
---@field show_tab_index_in_tab_bar? bool
533647
---@field show_tabs_in_tab_bar? bool
534648
---@field show_new_tab_button_in_tab_bar? bool
535-
-- If true, show_tab_index_in_tab_bar uses a zero-based index.
536-
--
537-
-- The default is false and the tab shows a one-based index
538649
---@field tab_and_split_indices_are_zero_based? bool
539-
-- Specifies the maximum width that a tab can have in the
540-
-- tab bar.
541-
--
542-
-- Defaults to 16 glyphs in width
543650
---@field tab_max_width? usize
544-
-- If true, hide the tab bar if the window only has a single tab.
545651
---@field hide_tab_bar_if_only_one_tab? bool
546652
---@field enable_scroll_bar? bool
547653
---@field min_scroll_bar_height? Dimension
548-
-- If `false`, do not try to use a Wayland protocol connection
549-
-- when starting the gui frontend, and instead use X11.
550-
--
551-
-- This option is only considered on X11/Wayland systems and
552-
-- has no effect on macOS or Windows.
553-
--
554-
-- The default is `true`
555-
---@field enable_wayland? bool
556654
---@field enable_zwlr_output_manager? bool
557655
---@field prefer_egl? bool
558656
-- If set to `true`, launching a new instance of wezterm will prefer to spawn
@@ -652,11 +750,8 @@
652750
-- The default is to scroll to the bottom when you send input
653751
-- to the terminal
654752
---@field scroll_to_bottom_on_input? bool
655-
---@field use_ime? bool
656-
---@field xim_im_name? string
657753
---@field ime_preedit_rendering? ImePreeditRendering
658754
---@field use_dead_keys? bool
659-
---@field launch_menu? SpawnCommand[]
660755
---@field use_box_model_render? bool
661756
---@field check_for_updates? bool
662757
---@field show_update_window? bool
@@ -700,14 +795,12 @@
700795
---@field default_workspace? string
701796
---@field xcursor_theme? string
702797
---@field xcursor_size? u32
703-
---@field key_map_preference? KeyMapPreference
704798
---@field quote_dropped_files? DroppedFileQuoting
705799
---@field ui_key_cap_rendering? UIKeyCapRendering
706800
---@field palette_max_key_assigments_for_action? usize
707801
---@field ulimit_nofile? u64
708802
---@field ulimit_nproc? u64
709803
---@field font_size? number
710-
---@field line_height? number
711804
---@field cell_width? any
712805
---@field cursor_thickess? Dimension
713806
---@field underline_thickness? Dimension
@@ -742,7 +835,6 @@
742835
---@field integrated_title_button_alignment? IntegratedTitleButtonAlignment
743836
---@field integrated_title_button_style? IntegratedTitleButtonStyle
744837
---@field integrated_title_button_color? "Auto"|AnsiColor
745-
---@field log_unknown_escape_sequences? bool
746838
---@field dpi? integer
747839
---@field bold_brightens_ansi_colors? BoldBrightening
748840
---@field font_dirs? table|string[]

lua/types/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@
584584
---@field window_close_hover? string
585585

586586
---@class HyperlinkRule
587-
---@field regex? Regex
588-
---@field format? string
589-
---@field highlight? usize
587+
---@field regex string
588+
---@field format string
589+
---@field highlight? 1
590590

591591
---@class SerialDomain
592592
-- The name of this specific domain.

0 commit comments

Comments
 (0)