DrKJeff16/wezterm-types
WezTerm config type annotations for LuaLS, including support for community plugins.
wezterm-types
This project aims to provide LuaCATS-like LuaLS type annotations for your WezTerm config.
Example videos can be found in EXAMPLES.md.
NOTE: For any missing or unclear types you should always double-check the WezTerm Lua Reference. If using an annotated plugin featured in this repository please refer to its author for any unclear types.
Features
- LuaCATS-like type annotations
- Built-in colorschemes included (
config.color_scheme) - Up-to-date descriptions
- Community plugin annotations
- Neovim support
- Through lazydev.nvim
- Through the built-in LSP API
- VSCode/VSCodium support by cloning this into
~/.config/wezterm, then editing your config in that directory
Table of Contents
Installation
LuaRocks
You can install wezterm-types using LuaRocks:
luarocks install wezterm-types # Global install
luarocks install --local wezterm-types # Local install
To get it running in Neovim please refer to this discussion.
Neovim
We recommend using lazy.nvim as a package manager:
{
'DrKJeff16/wezterm-types',
version = false, -- Get the latest version
},
Featured Plugins
This project also features type annotations for various WezTerm plugins.
If you want to add your plugin, please read CONTRIBUTING.md.
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.
Using lazydev.nvim
Install lazydev.nvim as suggested:
{
'folke/lazydev.nvim',
ft = 'lua',
dependencies = { 'DrKJeff16/wezterm-types' },
opts = {
library = {
-- Other library configs...
{ path = 'wezterm-types', mods = { 'wezterm' } },
},
},
}
If you download this repo under a diferent name, you can use the following instead:
{
'folke/lazydev.nvim',
ft = 'lua',
dependencies = {
{
'DrKJeff16/wezterm-types',
name = '<my_custom_name>', -- CUSTOM DIRECTORY NAME
},
},
opts = {
library = {
-- MAKE SURE TO MATCH THE PLUGIN DIRECTORY'S NAME
{ path = '<my_custom_name>', mods = { 'wezterm' } },
},
},
}
Using The Built-in Neovim LSP
Add the install path of wezterm-types in your lua_ls config.
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
settings = {
Lua = {
workspace = {
library = {
-- Other library paths...
'</path/to/wezterm-types>',
},
},
},
},
}
