1
1
mirror of https://github.com/wez/wezterm.git synced 2024-08-18 02:30:57 +03:00

docs: more config.something style adjustments

This commit is contained in:
Wez Furlong 2023-03-19 18:36:37 -07:00
parent 0f8146b212
commit 13aefd22fe
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
4 changed files with 97 additions and 128 deletions

View File

@ -14,13 +14,14 @@ in your `~/.wezterm.lua`:
```lua
local wezterm = require 'wezterm'
local config = {}
-- Use the defaults as a base
local hyperlink_rules = wezterm.default_hyperlink_rules()
config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- make task numbers clickable
-- the first matched regex group is captured in $1.
table.insert(hyperlink_rules, {
table.insert(config.hyperlink_rules, {
regex = [[\b[tt](\d+)\b]],
format = 'https://example.com/tasks/?t=$1',
})
@ -29,14 +30,12 @@ table.insert(hyperlink_rules, {
-- ( "nvim-treesitter/nvim-treesitter" | wbthomason/packer.nvim | wez/wezterm | "wez/wezterm.git" )
-- as long as a full url hyperlink regex exists above this it should not match a full url to
-- github or gitlab / bitbucket (i.e. https://gitlab.com/user/project.git is still a whole clickable url)
table.insert(hyperlink_rules, {
table.insert(config.hyperlink_rules, {
regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]],
format = 'https://www.github.com/$1/$3',
})
return {
hyperlink_rules = hyperlink_rules,
}
return config
```
See also [hyperlink_rules](config/lua/config/hyperlink_rules.md) and

View File

@ -35,8 +35,7 @@ To configure an SSH domain, place something like the following in
your `.wezterm.lua` file:
```lua
return {
ssh_domains = {
config.ssh_domains = {
{
-- This name identifies the domain
name = 'my.server',
@ -46,7 +45,6 @@ return {
-- The username to use on the remote host
username = 'wez',
},
},
}
```
@ -78,19 +76,17 @@ spawn a server if needed and then connect the gui to it automatically
when wezterm is launched:
```lua
return {
unix_domains = {
config.unix_domains = {
{
name = 'unix',
},
},
}
-- This causes `wezterm` to act as though it was started as
-- `wezterm connect unix` by default, connecting to the unix
-- domain on startup.
-- If you prefer to connect manually, leave out this line.
default_gui_startup_args = { 'connect', 'unix' },
}
config.default_gui_startup_args = { 'connect', 'unix' }
```
If you prefer to connect manually, omit the `default_gui_startup_args` setting
@ -107,8 +103,7 @@ option was shown as the way to connect on startup. Using
The possible configuration values are:
```lua
return {
unix_domains = {
config.unix_domains = {
{
-- The name; must be unique amongst all domains
name = 'unix',
@ -131,7 +126,6 @@ return {
-- skip_permissions_check = false,
},
},
}
```
@ -147,13 +141,11 @@ but may help with the WSL 2 issue mentioned below when translated
to an appropriate invocation of netcat/socat on Windows:
```lua
return {
unix_domains = {
config.unix_domains = {
{
name = 'unix',
proxy_command = { 'nc', '-U', '/Users/wez/.local/share/wezterm/sock' },
},
},
}
```
@ -167,13 +159,11 @@ result of that prediction locally without waiting, hence hiding latency to the
user. This option only applies when `multiplexing = "WezTerm"`.
```lua
return {
unix_domains = {
config.unix_domains = {
{
name = 'unix',
local_echo_threshold_ms = 10,
},
},
}
```
@ -184,8 +174,7 @@ return {
Inside your WSL instance, configure `.wezterm.lua` with this snippet:
```lua
return {
unix_domains = {
config.unix_domains = {
{
name = 'wsl',
-- Override the default path to match the default on the host win32
@ -195,22 +184,19 @@ return {
-- NTFS permissions will always be "wrong", so skip that check
skip_permissions_check = true,
},
},
}
```
In the host win32 configuration, use this snippet:
```lua
return {
unix_domains = {
config.unix_domains = {
{
name = 'wsl',
serve_command = { 'wsl', 'wezterm-mux-server', '--daemonize' },
},
},
default_gui_startup_args = { 'connect', 'wsl' },
}
config.default_gui_startup_args = { 'connect', 'wsl' }
```
Now when you start wezterm you'll be presented with a WSL tab.
@ -239,8 +225,7 @@ server.
For each server that you wish to connect to, add a client section like this:
```lua
return {
tls_clients = {
config.tls_clients = {
{
-- A handy alias for this session; you will use `wezterm connect server.name`
-- to connect to it.
@ -251,7 +236,6 @@ return {
-- `wezterm ssh` subcommand.
bootstrap_via_ssh = 'server.hostname',
},
},
}
```
@ -261,14 +245,12 @@ settings.
### Configuring the server
```lua
return {
tls_servers = {
config.tls_servers = {
{
-- The host:port combination on which the server will listen
-- for connections
bind_address = 'server.hostname:8080',
},
},
}
```

View File

@ -18,10 +18,8 @@ may put some pressure on your system depending on the amount of RAM
you have available.
```lua
return {
-- How many lines of scrollback you want to retain per tab
scrollback_lines = 3500,
}
config.scrollback_lines = 3500
```
### Clearing the scrollback buffer
@ -39,13 +37,11 @@ You can control whether WezTerm displays a scrollbar via your configuration
file:
```lua
return {
-- Enable the scrollbar.
-- It will occupy the right window padding space.
-- If right padding is set to 0 then it will be increased
-- to a single cell width
enable_scroll_bar = true,
}
config.enable_scroll_bar = true
```
You may [change the color of the scrollbar](config/appearance.md#defining-your-own-colors) if you wish!
@ -117,16 +113,13 @@ for your mouse to copy and paste a relevant git commit hash then you might like
this:
```lua
local wezterm = require 'wezterm'
return {
keys = {
config.keys = {
-- search for things that look like git hashes
{
key = 'H',
mods = 'SHIFT|CTRL',
action = wezterm.action.Search { Regex = '[a-f0-9]{6,}' },
},
},
}
```

View File

@ -100,10 +100,8 @@ the visible prompt with green and purple colors, and makes the prompt
span multiple lines:
```lua
return {
set_environment_variables = {
config.set_environment_variables = {
prompt = '$E]7;file://localhost/$P$E\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m ',
},
}
```
@ -154,25 +152,22 @@ you might configure this:
```lua
local wezterm = require 'wezterm'
local config = {}
local default_prog
local set_environment_variables = {}
config.set_environment_variables = {}
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
-- Use OSC 7 as per the above example
set_environment_variables['prompt'] =
config.set_environment_variables['prompt'] =
'$E]7;file://localhost/$P$E\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m '
-- use a more ls-like output format for dir
set_environment_variables['DIRCMD'] = '/d'
config.set_environment_variables['DIRCMD'] = '/d'
-- And inject clink into the command prompt
default_prog =
config.default_prog =
{ 'cmd.exe', '/s', '/k', 'c:/clink/clink_x64.exe', 'inject', '-q' }
end
return {
default_prog = default_prog,
set_environment_variables = set_environment_variables,
}
return config
```
Now, rather than just running `cmd.exe` on its own, this will cause `cmd.exe`