29 个版本 (10 个稳定版)
2.2.1 | 2024 年 7 月 27 日 |
---|---|
2.2.0 | 2024 年 3 月 7 日 |
2.1.2 | 2024 年 1 月 21 日 |
2.1.0 | 2023 年 11 月 3 日 |
0.5.0 | 2022 年 12 月 29 日 |
#283 in 命令行工具
每月 170 次下载
52KB
1.5K SLoC
Muxi
为您的 tmux 会话创建动态快捷方式!
安装
cargo install muxi
用法
❯ muxi
Create bookmarks for your tmux sessions on the fly! 🚀
Usage: muxi <COMMAND>
Commands:
init Register within Tmux and add bindings
config See and edit your settings
sessions See and manage your muxi sessions
completions Generate completions for your shell
fzf Spawn a FZF popup to manage your muxi sessions
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
配置
Lua
您可以在以下位置之一提供 init.lua
$MUXI_CONFIG_PATH
$XDG_CONFIG_HOME/muxi/
~/.config/muxi/
或者运行 muxi config edit
在您喜欢的 $EDITOR
中打开它
-- Optional: Use tmux <prefix> to define muxi's table (default: true)
muxi.tmux_prefix = true
-- Optional: Muxi's table binding (default: "g"), will result in `<prefix>g`
muxi.muxi_prefix = "g"
-- Optional: Uppercase letters will set the current session (default: false)
muxi.uppercase_overrides = false
-- Optional: Set current session path to current pane's path
muxi.use_current_pane_path = false
-- Optional bindings to be created on tmux's muxi table (Examples shown)
muxi.bindings = {
-- <prefix>ge => edit your sessions file (You can pass optional arguments to your editor after "--")
e = {
popup = { title = " sessions " },
command = "muxi sessions edit -- +ZenMode",
},
-- <prefix>gc => edit config
c = {
popup = {
title = " config ",
width = "75%",
height = "60%"
},
command = "muxi config edit -- -c 'nmap <silent> q :wqa<cr>'"
},
-- <prefix>gs => session switcher
s = { popup = { title = " muxi " }, command = "muxi sessions switch --interactive" },
-- <prefix>gf => FZF integration
f = { command = "muxi fzf" },
-- <prefix>gt => session switcher (native tmux menu)
t = { command = "muxi sessions switch --tmux-menu" },
-- You can bind your own commands too!
-- `tmux run-shell "tmux switch-client -l"`
["M-Space"] = { command = "tmux switch-client -l" },
g = { command = "tmux send htop Enter" },
}
然后在您的 tmux.conf
中启动 muxi
if "type muxi" {
run -b "muxi init"
}
Tmux 变量
您也可以从您的 tmux 配置中完全定义设置
# Optional settings (default values shown)
set -g @muxi-use-tmux-prefix 'on' # on|off
set -g @muxi-prefix 'g' # Any valid tmux key, like `M-Space`
set -g @muxi-uppercase-overrides 'off' # on|off
set -g @muxi-use-current-pane-path 'off' # on|off
# Init muxi
if "type muxi" {
# If you're going to define bindings on the muxi table, don't use `-b`
run "muxi init"
}
# Define bindings on the muxi table:
# <prefix>ge => Edit sessions in your editor
bind -T muxi e popup -w 76% -h 75% -b rounded -T " sessions " -E "muxi sessions edit -- +ZenMode -c 'nmap <silent> q :wqa<cr>'"
# TIP: Using the native tmux menu is a good alternative to the common workflow,
# it'll map your session bindings to the menu
bind 'f' run 'muxi sessions switch --tmux-menu'
会话
运行 muxi sessions edit
将打开您的 sessions.toml
文件,它看起来可能如下所示
# <key> = { name = <session_name>, path = <session_path> }
d = { name = "dotfiles", path = "~/.dotfiles" }
m = { name = "muxi", path = "~/Sites/rust/muxi/" }
n = { name = "notes", path = "~/Library/Mobile Documents/com~apple~CloudDocs/notes" }
这是 muxi
将用于生成会话绑定和保持状态文件。退出编辑器后,muxi
将重新同步会话(同样也适用于您的配置!)
依赖项
~8–21MB
~249K SLoC