3 ms·
Thanks for the tip. I briefly read through the docs and it's not clear what this offers above and beyond what tmux does?
by Dowwie 9y ago
Thanks for the tip. I briefly read through the docs and it's not clear what this offers above and beyond what tmux does?
- cevn 9y agoI think the idea is to be able to use tmux in different layouts, configured by simple plaintext. I'll try it out.
- kaushalmodi 9y agoThe benefit of tmuxp is pretty clear from its README[1]. It gives this example: 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 The example is very simple (I use tmuxp to heavily configure the session initialization), but it shows how you can have a config file to set a session's name, set the number and names of windows in there, set the layout of panes differently if you want in each window, run commands like "cd", set env vars differently if you want, in each pane. You can find a lot more examples of tmuxp config on its doc site[2]. tmux doesn't allow one to have such quick, easy-to-read config files. You can of course do most of this in your .tmux.conf, but it will be too complicated to allow reuse and quick modifications. [1]: https://github.com/tmux-python/tmuxp#load-a-tmux-session https://github.com/tmux-python/tmuxp#load-a-tmux-session [2]: https://tmuxp.git-pull.com/en/latest/examples.html https://tmuxp.git-pull.com/en/latest/examples.html
- w0m 9y agoThat looks handy, i can see a, 'setup my testing and development environment' with just a quick cp-and-edit of config file.
- accnumnplus1 9y agoI use a shell script for such config. eg tmux split-window -h ; tmux send-keys "ls -la" C-m; ...
- kaushalmodi 9y agoAs I mentioned earlier, it is possible to do such things within the .tmux.conf, but not practical. Here's one of my real tmuxp configs: # How to use this file: # tmuxp load /path/to/this/file/main.yaml # - Specifying the .yaml extension is optional # - Specifying the path is optional if file is in ~/.tmuxp # # tmuxp --help for full help. session_name: main suppress_history: false start_directory: '~' shell_command_before: - unsetenv SHELL_CONFIG_LOADED - source ~/.alias windows: - window_name: '*scratch*' layout: tiled focus: true panes: - cd ~/downloads/git # Top-left - cd ~/downloads/git/emacs # Top-right - focus: true # Bottom-left shell_command: - bob - sleep 2 - tclr # Clear tmux status indicators - shell_command: # Bottom-right - cd ~/.emacs.d/elisp/org-mode - module load gcc/6.1.0 # Needed for ob-fortran tests to pass when doing make test for Org - window_name: foo-1 layout: even-horizontal shell_command_before: - bob - cduh panes: - null - null - null - window_name: foo-2 layout: tiled shell_command_before: - bob - cduh panes: - null - null - null - null - window_name: uvm_lib layout: tiled panes: - cd ~/gitlab/bar_uvm_lib - window_name: sandbox layout: even-horizontal panes: - null - null - null - window_name: hugo layout: tiled panes: - shell_command: - cd '~/downloads/git' - shell_command: - cd '~/e/elisp/ox-hugo/example-site' - ./srv - shell_command: - cd '~/hugo' - focus: true shell_command: - cd '~/e/elisp/ox-hugo' - window_name: nim layout: even-horizontal panes: - cd ~/sandbox/nim - cd ~/sandbox/nim - focus: true shell_command: - cd ~/sandbox/nim/chat - window_name: tok layout: even-horizontal shell_command_before: - tok - cduh panes: - null - null - null - window_name: zoo layout: even-horizontal shell_command_before: - bob - cduh panes: - null - null - null