wezterm的workspace配置

2022-07-13 • 预计阅读时间 1 分钟

wezterm里个特性是workspace,类似虚拟桌面的概念.可以在不同的workspace之间切换.这段时间工作上除了日常的开发以外,还有一些服务器的维护.这个时候这个workspace就会很方便.

另外可以根据 lua 来获取环境变量,来区分个人电脑、办公电脑做到能够一套配置多处使用.在 DUMMY 的机器上启动一个 Meta 的配置

if "DUMMY" == os.getenv("USERDOMAIN") then
		local tab, pane, window = mux.spawn_window {
			workspace = "Meta",
			cwd = "d:/soft/Meta/",
		}
		pane:send_text(".\\meta.exe -d .\n")
end

官方有如下的一个配置示例.

local wezterm = require 'wezterm'
local mux = wezterm.mux

wezterm.on("gui-startup", function()
  -- Set a workspace for coding on a current project
  -- Top pane is for the editor, bottom pane is for the build tool
  local project_dir = wezterm.home_dir .. "/wezterm"
  local tab, build_pane, window = mux.spawn_window{
	workspace="coding",
	cwd=project_dir,
  }
  local editor_pane = build_pane:split{
	direction="Top",
	size=0.6,
	cwd=project_dir
  }
  -- may as well kick off a build in that pane
  build_pane:send_text("cargo build\n")

  -- A workspace for interacting with a local machine that
  -- runs some docker containners for home automation
  local tab, pane, window = mux.spawn_window{
	workspace="automation",
	args={"ssh", "vault"},
  }

  -- We want to startup in the coding workspace
  mux.set_active_workspace("coding")
end)

return {}

参考资料

softwezterm

wentao

写点代码,解决点问题。

利用PowerShell来进行端口连通性测试

PSReadLine最强PowerShell模块