mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 22:37:11 +03:00
docs: more config.something style adjustments
This commit is contained in:
parent
0f8146b212
commit
13aefd22fe
@ -14,13 +14,14 @@ in your `~/.wezterm.lua`:
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
|
local config = {}
|
||||||
|
|
||||||
-- Use the defaults as a base
|
-- Use the defaults as a base
|
||||||
local hyperlink_rules = wezterm.default_hyperlink_rules()
|
config.hyperlink_rules = wezterm.default_hyperlink_rules()
|
||||||
|
|
||||||
-- make task numbers clickable
|
-- make task numbers clickable
|
||||||
-- the first matched regex group is captured in $1.
|
-- the first matched regex group is captured in $1.
|
||||||
table.insert(hyperlink_rules, {
|
table.insert(config.hyperlink_rules, {
|
||||||
regex = [[\b[tt](\d+)\b]],
|
regex = [[\b[tt](\d+)\b]],
|
||||||
format = 'https://example.com/tasks/?t=$1',
|
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" )
|
-- ( "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
|
-- 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)
|
-- 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\.]+)["]?]],
|
regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]],
|
||||||
format = 'https://www.github.com/$1/$3',
|
format = 'https://www.github.com/$1/$3',
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return config
|
||||||
hyperlink_rules = hyperlink_rules,
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
See also [hyperlink_rules](config/lua/config/hyperlink_rules.md) and
|
See also [hyperlink_rules](config/lua/config/hyperlink_rules.md) and
|
||||||
|
@ -35,17 +35,15 @@ To configure an SSH domain, place something like the following in
|
|||||||
your `.wezterm.lua` file:
|
your `.wezterm.lua` file:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.ssh_domains = {
|
||||||
ssh_domains = {
|
{
|
||||||
{
|
-- This name identifies the domain
|
||||||
-- This name identifies the domain
|
name = 'my.server',
|
||||||
name = 'my.server',
|
-- The hostname or address to connect to. Will be used to match settings
|
||||||
-- The hostname or address to connect to. Will be used to match settings
|
-- from your ssh config file
|
||||||
-- from your ssh config file
|
remote_address = '192.168.1.1',
|
||||||
remote_address = '192.168.1.1',
|
-- The username to use on the remote host
|
||||||
-- The username to use on the remote host
|
username = 'wez',
|
||||||
username = 'wez',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -78,19 +76,17 @@ spawn a server if needed and then connect the gui to it automatically
|
|||||||
when wezterm is launched:
|
when wezterm is launched:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.unix_domains = {
|
||||||
unix_domains = {
|
{
|
||||||
{
|
name = 'unix',
|
||||||
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' },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- 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.
|
||||||
|
config.default_gui_startup_args = { 'connect', 'unix' }
|
||||||
```
|
```
|
||||||
|
|
||||||
If you prefer to connect manually, omit the `default_gui_startup_args` setting
|
If you prefer to connect manually, omit the `default_gui_startup_args` setting
|
||||||
@ -107,30 +103,28 @@ option was shown as the way to connect on startup. Using
|
|||||||
The possible configuration values are:
|
The possible configuration values are:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.unix_domains = {
|
||||||
unix_domains = {
|
{
|
||||||
{
|
-- The name; must be unique amongst all domains
|
||||||
-- The name; must be unique amongst all domains
|
name = 'unix',
|
||||||
name = 'unix',
|
|
||||||
|
|
||||||
-- The path to the socket. If unspecified, a resonable default
|
-- The path to the socket. If unspecified, a resonable default
|
||||||
-- value will be computed.
|
-- value will be computed.
|
||||||
|
|
||||||
-- socket_path = "/some/path",
|
-- socket_path = "/some/path",
|
||||||
|
|
||||||
-- If true, do not attempt to start this server if we try and fail to
|
-- If true, do not attempt to start this server if we try and fail to
|
||||||
-- connect to it.
|
-- connect to it.
|
||||||
|
|
||||||
-- no_serve_automatically = false,
|
-- no_serve_automatically = false,
|
||||||
|
|
||||||
-- If true, bypass checking for secure ownership of the
|
-- If true, bypass checking for secure ownership of the
|
||||||
-- socket_path. This is not recommended on a multi-user
|
-- socket_path. This is not recommended on a multi-user
|
||||||
-- system, but is useful for example when running the
|
-- system, but is useful for example when running the
|
||||||
-- server inside a WSL container but with the socket
|
-- server inside a WSL container but with the socket
|
||||||
-- on the host NTFS volume.
|
-- on the host NTFS volume.
|
||||||
|
|
||||||
-- skip_permissions_check = false,
|
-- skip_permissions_check = false,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -147,12 +141,10 @@ but may help with the WSL 2 issue mentioned below when translated
|
|||||||
to an appropriate invocation of netcat/socat on Windows:
|
to an appropriate invocation of netcat/socat on Windows:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.unix_domains = {
|
||||||
unix_domains = {
|
{
|
||||||
{
|
name = 'unix',
|
||||||
name = 'unix',
|
proxy_command = { 'nc', '-U', '/Users/wez/.local/share/wezterm/sock' },
|
||||||
proxy_command = { 'nc', '-U', '/Users/wez/.local/share/wezterm/sock' },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -167,12 +159,10 @@ result of that prediction locally without waiting, hence hiding latency to the
|
|||||||
user. This option only applies when `multiplexing = "WezTerm"`.
|
user. This option only applies when `multiplexing = "WezTerm"`.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.unix_domains = {
|
||||||
unix_domains = {
|
{
|
||||||
{
|
name = 'unix',
|
||||||
name = 'unix',
|
local_echo_threshold_ms = 10,
|
||||||
local_echo_threshold_ms = 10,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -184,17 +174,15 @@ return {
|
|||||||
Inside your WSL instance, configure `.wezterm.lua` with this snippet:
|
Inside your WSL instance, configure `.wezterm.lua` with this snippet:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.unix_domains = {
|
||||||
unix_domains = {
|
{
|
||||||
{
|
name = 'wsl',
|
||||||
name = 'wsl',
|
-- Override the default path to match the default on the host win32
|
||||||
-- Override the default path to match the default on the host win32
|
-- filesystem. This will allow the host to connect into the WSL
|
||||||
-- filesystem. This will allow the host to connect into the WSL
|
-- container.
|
||||||
-- container.
|
socket_path = '/mnt/c/Users/USERNAME/.local/share/wezterm/sock',
|
||||||
socket_path = '/mnt/c/Users/USERNAME/.local/share/wezterm/sock',
|
-- NTFS permissions will always be "wrong", so skip that check
|
||||||
-- NTFS permissions will always be "wrong", so skip that check
|
skip_permissions_check = true,
|
||||||
skip_permissions_check = true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -202,15 +190,13 @@ return {
|
|||||||
In the host win32 configuration, use this snippet:
|
In the host win32 configuration, use this snippet:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.unix_domains = {
|
||||||
unix_domains = {
|
{
|
||||||
{
|
name = 'wsl',
|
||||||
name = 'wsl',
|
serve_command = { 'wsl', 'wezterm-mux-server', '--daemonize' },
|
||||||
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.
|
Now when you start wezterm you'll be presented with a WSL tab.
|
||||||
@ -239,18 +225,16 @@ server.
|
|||||||
For each server that you wish to connect to, add a client section like this:
|
For each server that you wish to connect to, add a client section like this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.tls_clients = {
|
||||||
tls_clients = {
|
{
|
||||||
{
|
-- A handy alias for this session; you will use `wezterm connect server.name`
|
||||||
-- A handy alias for this session; you will use `wezterm connect server.name`
|
-- to connect to it.
|
||||||
-- to connect to it.
|
name = 'server.name',
|
||||||
name = 'server.name',
|
-- The host:port for the remote host
|
||||||
-- The host:port for the remote host
|
remote_address = 'server.hostname:8080',
|
||||||
remote_address = 'server.hostname:8080',
|
-- The value can be "user@host:port"; it accepts the same syntax as the
|
||||||
-- The value can be "user@host:port"; it accepts the same syntax as the
|
-- `wezterm ssh` subcommand.
|
||||||
-- `wezterm ssh` subcommand.
|
bootstrap_via_ssh = 'server.hostname',
|
||||||
bootstrap_via_ssh = 'server.hostname',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -261,13 +245,11 @@ settings.
|
|||||||
### Configuring the server
|
### Configuring the server
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.tls_servers = {
|
||||||
tls_servers = {
|
{
|
||||||
{
|
-- The host:port combination on which the server will listen
|
||||||
-- The host:port combination on which the server will listen
|
-- for connections
|
||||||
-- for connections
|
bind_address = 'server.hostname:8080',
|
||||||
bind_address = 'server.hostname:8080',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -18,10 +18,8 @@ may put some pressure on your system depending on the amount of RAM
|
|||||||
you have available.
|
you have available.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
-- How many lines of scrollback you want to retain per tab
|
||||||
-- How many lines of scrollback you want to retain per tab
|
config.scrollback_lines = 3500
|
||||||
scrollback_lines = 3500,
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clearing the scrollback buffer
|
### Clearing the scrollback buffer
|
||||||
@ -39,13 +37,11 @@ You can control whether WezTerm displays a scrollbar via your configuration
|
|||||||
file:
|
file:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
-- Enable the scrollbar.
|
||||||
-- Enable the scrollbar.
|
-- It will occupy the right window padding space.
|
||||||
-- It will occupy the right window padding space.
|
-- If right padding is set to 0 then it will be increased
|
||||||
-- If right padding is set to 0 then it will be increased
|
-- to a single cell width
|
||||||
-- to a single cell width
|
config.enable_scroll_bar = true
|
||||||
enable_scroll_bar = true,
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You may [change the color of the scrollbar](config/appearance.md#defining-your-own-colors) if you wish!
|
You may [change the color of the scrollbar](config/appearance.md#defining-your-own-colors) if you wish!
|
||||||
@ -117,15 +113,12 @@ for your mouse to copy and paste a relevant git commit hash then you might like
|
|||||||
this:
|
this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
config.keys = {
|
||||||
return {
|
-- search for things that look like git hashes
|
||||||
keys = {
|
{
|
||||||
-- search for things that look like git hashes
|
key = 'H',
|
||||||
{
|
mods = 'SHIFT|CTRL',
|
||||||
key = 'H',
|
action = wezterm.action.Search { Regex = '[a-f0-9]{6,}' },
|
||||||
mods = 'SHIFT|CTRL',
|
|
||||||
action = wezterm.action.Search { Regex = '[a-f0-9]{6,}' },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -100,10 +100,8 @@ the visible prompt with green and purple colors, and makes the prompt
|
|||||||
span multiple lines:
|
span multiple lines:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
return {
|
config.set_environment_variables = {
|
||||||
set_environment_variables = {
|
prompt = '$E]7;file://localhost/$P$E\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m ',
|
||||||
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
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
|
local config = {}
|
||||||
|
|
||||||
local default_prog
|
config.set_environment_variables = {}
|
||||||
local set_environment_variables = {}
|
|
||||||
|
|
||||||
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
|
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
|
||||||
-- Use OSC 7 as per the above example
|
-- 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 '
|
'$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
|
-- 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
|
-- And inject clink into the command prompt
|
||||||
default_prog =
|
config.default_prog =
|
||||||
{ 'cmd.exe', '/s', '/k', 'c:/clink/clink_x64.exe', 'inject', '-q' }
|
{ 'cmd.exe', '/s', '/k', 'c:/clink/clink_x64.exe', 'inject', '-q' }
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return config
|
||||||
default_prog = default_prog,
|
|
||||||
set_environment_variables = set_environment_variables,
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, rather than just running `cmd.exe` on its own, this will cause `cmd.exe`
|
Now, rather than just running `cmd.exe` on its own, this will cause `cmd.exe`
|
||||||
|
Loading…
Reference in New Issue
Block a user