Skip to content

DrKJeff16/wezterm-types

Repository files navigation

wezterm-types

Mentioned in Awesome WezTerm | Mentioned in Awesome Neovim

Credits | Roadmap | Discussions

This project aims to provide LuaCATS-like Lua Language Server type annotations for your WezTerm config.

NOTE: While this was made with an aim to be thorough you should always double-check the WezTerm Lua Reference for any missing or unclear types.

Examples can be found here.


Table of Contents


Features

  • LuaCATS-like type annotations
  • Built-in colorschemes included (config.color_scheme)
  • Up-to-date descriptions
  • Function overrides (e.g. wezterm.on())
  • Neovim support through folke/lazydev.nvim
  • VSCode/VSCodium support by cloning this into ~/.config/wezterm, and editing your config in that directory

Installation

Neovim

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

{
  '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
    },
  },
}

LuaRocks

You can now install this with LuaRocks:

luarocks install wezterm-types # Global install
luarocks install --local wezterm-types # Local install

Usage

After installing the types, add the type annotations to wezterm and config respectively when running require("wezterm") in your configuration.

A useful example:

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

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

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.


Collaborators

gonstoll
Gonzalo Stoll
DrKJeff16
Guennadi Maximov C
justinsgithub
Justin Angeles

Contributors

DrKJeff16
Guennadi Maximov C
justinsgithub
Justin Angeles
craigmac
C.D. MacEachern
chrisgrieser
Chris Grieser
AtifChy
Md. Iftakhar Awal Chowdhury
TheLeoP
Luis Calle
reegnz
Zoltán Reegn
Zuyoutoki
Zuyoutoki

License

MIT


Star History Chart