DrKJeff16/wezterm-types

github github
neovim-lua-development
stars 92
issues 0
subscribers 2
forks 21
CREATED

UPDATED


wezterm-types

Mentioned in Awesome WezTerm | Mentioned in Awesome Neovim

Roadmap | Discussions

WezTerm config type annotations for Lua Language Server.


https://github.com/user-attachments/assets/02c261ac-5744-4f34-b767-48095386e21b

https://github.com/user-attachments/assets/3693aedf-b790-4618-b969-1b712010bd4f


Table of Contents

  1. Features
  2. Installation
    1. Neovim
  3. Usage
  4. Credits
    1. Maintainers
    2. Maintainers
  5. Structure

Features

  • Built-in colorschemes included (config.color_scheme)
  • Up to date descriptions
  • Function overrides annotated
  • Neovim support through lazydev.nvim
  • VSCode support by cloning this into ~/.config/wezterm, and editing your config in that directory

Installation

Neovim

For Neovim users, we recommend using lazy.nvim as a package manager, to be used with lazydev:

require('lazy').setup({
  spec = {
    {
      'folke/lazydev.nvim',
      ft = 'lua',
      dependencies = {
        {
          'DrKJeff16/wezterm-types',
          lazy = true,
          version = false, -- Get the latest version
        },
      },
      opts = {
        library = {
          -- Other library configs...
          { path = 'wezterm-types', mods = { 'wezterm' } },
        },
      },
    },
  },
})

[!TIP] If you download this repo under a diferent name, you can use the following instead:

{
  {
    'folke/lazydev.nvim',
    ft = 'lua',
    dependencies = {
      {
        'DrKJeff16/wezterm-types',
        lazy = true,
        name = '<my_custom_name>', -- CUSTOM DIRECTORY NAME
        version = false, -- Get the latest version
      },
    },
    opts = {
      library = {
        -- Other library configs...
        { path = '<my_custom_name>', mods = { 'wezterm' } }, -- MAKE SURE TO MATCH THE PLUGIN DIRECTORY'S NAME
      },
    },
  },
}

Usage

After installing the types, add the type annotations to wezterm and config respectively when requiring wezterm in your configuration:

---@type Wezterm
local wezterm = require("wezterm")

---@type Config
local config = wezterm.config_builder()

-- Your configuration here with full type support
config.window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW"

return config

These annotations enable the Lua Language Server to provide proper type checking and autocompletion for WezTerm configuration options.


Credits

Maintainers

Contributors


Structure

The project is structured the following way:

/lua/wezterm/types/
├── config.lua  <==  Contains the `Config` class and related data types
├── enum.lua  <==   Imports all the `enum/` files
├── enum/  <==   Enum types
│   ├── copy-mode-assignment.lua  <==  `CopyModeAssignment` enum types
│   └── key-assignment.lua  <==   `KeyAssignment` enum types
├── events.lua  <==  Imports all the `events/` files
├── events/  <==  Events type files
│   ├── gui.lua  <==  `Gui` event types
│   ├── multiplexer.lua  <==  `Mux` event types
│   └── window.lua  <==  `Window` event types
├── objects.lua  <==  Imports all the `objects/` files
├── objects/  <==  Objects type files
│   ├── color.lua  <==  `Color` object types
│   ├── exec-domain.lua  <==  `ExecDomain` object types
│   ├── local-process-info.lua  <==  `LocalProcessInfo` object types
│   ├── mux-domain.lua  <==  `MuxDomain` object types
│   ├── mux-tab.lua  <==  `MuxTab` object types
│   ├── mux-window.lua  <==  `MuxWindow` object types
│   ├── pane-information.lua  <==  `PaneInformation` object types
│   ├── pane.lua  <==  `Pane` object types
│   ├── spawn-command.lua  <==  `SpawnCommand` object types
│   ├── ssh-domain.lua  <==  `SshDomain` object types
│   ├── tab-information.lua  <==  `TabInformation` object types
│   ├── time.lua  <==  `Time` object types
│   ├── tls-domain-client.lua  <==  `TlsDomainClient` object types
│   ├── tls-domain-server.lua  <==  `TlsDomainServer` object types
│   ├── window.lua  <==  `Window` object types
│   └── wsl-domain.lua  <==  `WslDomain` object types
├── wezterm.lua  <==  Imports all the surrounding files, including the `wezterm/` directory
├── wezterm/  <==  Types for the `wezterm` module
│   ├── color.lua  <==  `Wezterm.Color` module types
│   ├── gui.lua  <==  `Wezterm.Gui` module types
│   ├── mux.lua  <==  `Wezterm.Mux` module types
│   ├── nerdfonts.lua  <==  `Wezterm.NerdFonts` module types
│   ├── plugin.lua  <==  `Wezterm.Plugin` module types
│   ├── procinfo.lua  <==  `Wezterm.ProcInfo` module types
│   ├── serde.lua  <==  `Wezterm.Serde` module types
│   ├── time.lua  <==  `Wezterm.Time` module types
└───└── url.lua  <==  `Wezterm.Url` module types

License

MIT