tmuxp

💻 tmux session manager. built on libtmux
授权协议 MIT License
开发语言 Python
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 傅彬
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

tmuxp, tmux session manager. built onlibtmux.

DocsBuild status

We need help! tmuxp is a trusted session manager for tmux. If youcould lend your time to helping answer issues and QA pull requests,please do! See issue#290!

New to tmux? The Tao of tmuxis available on Leanpub and Amazon Kindle.Read and browse the book for free on theweb.

Installation

Pip

$ pip install --user tmuxp

Homebrew

$ brew install tmuxp

Load a tmux session

Load tmux sessions via json and YAML,tmuxinator andteamocil style.

session_name: 4-pane-split
windows:
  - window_name: dev window
    layout: tiled
    shell_command_before:
      - cd ~/ # run as a first command in all panes
    panes:
      - shell_command: # pane no. 1
          - cd /var/log # run multiple commands in this pane
          - ls -al | grep \.log
      - echo second pane # pane no. 2
      - echo third pane # pane no. 3
      - echo forth pane # pane no. 4

Save as mysession.yaml, and load:

$ tmuxp load ./mysession.yaml

Projects with .tmuxp.yaml or .tmuxp.json load via directory:

$ tmuxp load path/to/my/project/

Load multiple at once (in bg, offer to attach last):

$ tmuxp load mysession ./another/project/

Name a session:

$ tmxup load -s session_name ./mysession.yaml

simple andveryelaborateconfig examples

User-level configurations

tmuxp checks for configs in user directories:

  • $TMUXP_CONFIGDIR, if set
  • $XDG_CONFIG_HOME, usually $HOME/.config/tmuxp/
  • $HOME/.tmuxp/

Load your tmuxp config from anywhere by using the filename, assuming~/.config/tmuxp/mysession.yaml (or .json):

$ tmuxp load mysession

See author's tmuxp configs andthe projects'tmuxp.yaml.

Shell

New in 1.6.0:

tmuxp shell launches into a python console preloaded with the attachedserver, session, and window inlibtmux objects.

$ tmuxp shell

(Pdb) server
<libtmux.server.Server object at 0x7f7dc8e69d10>
(Pdb) server.sessions
[Session($1 your_project)]
(Pdb) session
Session($1 your_project)
(Pdb) session.name
'your_project'
(Pdb) window
Window(@3 1:your_window, Session($1 your_project))
(Pdb) window.name
'your_window'
(Pdb) window.panes
[Pane(%6 Window(@3 1:your_window, Session($1 your_project)))
(Pdb) pane
Pane(%6 Window(@3 1:your_window, Session($1 your_project))

Python 3.7+ supports PEP553 breakpoint()(including PYTHONBREAKPOINT). Also supports direct commands via -c:

$ tmuxp shell -c 'print(window.name)'
my_window

$ tmuxp shell -c 'print(window.name.upper())'
MY_WINDOW

Read more on tmuxp shell inthe CLI docs.

Pre-load hook

Run custom startup scripts (such as installing project dependenciesbefore loading tmux. See thebootstrap_env.pyandbefore_scriptexample

Load in detached state

You can also load sessions in the background by passing -d flag

Screenshot

image

Freeze a tmux session

Snapshot your tmux layout, pane paths, and window/session names.

$ tmuxp freeze session-name

See more about freezingtmux sessions.

Convert a session file

Convert a session file from yaml to json and vice versa.

$ tmuxp convert filename

This will prompt you for confirmation and shows you the new file that isgoing to be written.

You can auto confirm the prompt. In this case no preview will be shown.

$ tmuxp convert -y filename
$ tmuxp convert --yes filename

Plugin System

tmuxp has a plugin system to allow for custom behavior. See more aboutthe Plugin System.

Debugging Helpers

The load command provides a way to log output to a log file fordebugging purposes.

$ tmuxp load --log-file <log-file-name> .

Collect system info to submit with a Github issue:

$ tmuxp debug-info
------------------
environment:
    system: Linux
    arch: x86_64

# ... so on

Docs / Reading material

See the Quickstart.

Documentation homepage (also in中文)

Want to learn more about tmux itself? Read The Tao of Tmuxonline.

Donations

Your donations fund development of new features, testing and support.Your money will go directly to maintenance and development of theproject. If you are an individual, feel free to give whatever feelsright for the value you get out of the project.

See donation options at https://git-pull.com/support.html.

Project details

  • 几个痛点 在刚工作的时候,我直接把代码在 IDE 中进行编写并 shift + F10 运行,在一个 IDE 中可以同时运行多个程序,不用考虑部署问题;但是毕竟工作环境稳定性不够,断电、断网,机器更新重启等都会导致程序中断,于是为了稳定性,决定把程序部署在服务器上,即通过 Xftp 将代码上传到服务器之后,在 Xshell 中运行,但是 Xshell 中运行程序也会遇到一些问题。 1、本机通过 X

  • Tmux Tmux 简介 Tmux 是一个终端复用神器; 举个例子,当我们打开一个终端窗口,会话开始,然后通过命令启动程序,如果不通过后台的方式运行程序,关掉终端后程序就会关闭; 因为 终端窗口与其中启动的进程是连在一起的。打开窗口,会话开始;关闭窗口,会话结束,会话内部的进程也会随之终止,不管有没有运行完。 而 Tmux 解绑了会话和终端窗口。关闭终端窗口再打开,会话并不终止,程序也可以保持运行

相关阅读

相关文章

相关问答

相关文档