Skip to content

Commit eafb643

Browse files
authored
Release 0.4.0 version! Check the Changelog!
This commit introduces the following changes: - Splits Support: Users can now define multi-pane windows in their YAML configuration using the panes field. Supported layouts include tiled, even-horizontal, and even-vertical. - Enhanced Preview: The fzf preview window now displays detailed information about splits, including pane commands and layouts. - Improved Error Handling: Added clearer error messages for invalid configurations, such as duplicate session names or unsupported layouts. - Refactored Code: Cleaned up the session creation logic to handle splits more efficiently.
2 parents 6fbd83f + a08d4ff commit eafb643

3 files changed

Lines changed: 454 additions & 184 deletions

File tree

README.md

Lines changed: 156 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,131 @@
1-
# Zmux-Sessionizer
2-
Zmux is a shell script written in bash to create, manage and open session in `Tmux`.
3-
You can check [here](https://github.com/MrSloth-dev/.dotfiles/blob/main/scripts/zmux.sh) the shell script that was the origin of the idea for this plugin.
1+
# ⚡⚙️ Zmux-Sessionizer ⚡⚙️
2+
3+
Zmux is a bash script designed to make, managing and creating Tmux sessions a breeze.
4+
5+
Whether you're juggling multiple projects or just need a quick way to organize your workflow, Zmux has got you covered!
6+
7+
48

59
![img](assets/preview.png)
610

7-
# Instalation
11+
12+
## Instalation 📥
13+
14+
### Step 1: Download Zmux
15+
Choose a directory where you want to install Zmux (e.g., `~/.local/bin`, `~/bin`, or any directory in your `$PATH`).
16+
``` bash
17+
# Example: Install to ~/.local/bin
18+
mkdir -p ~/.local/bin
19+
curl -o ~/.local/bin/zmux https://raw.githubusercontent.com/MrSloth-dev/eZmux/main/zmux
20+
chmod +x ~/.local/bin/zmux
21+
```
22+
23+
### Step 2: Add to $PATH
24+
Ensure the installation directory is in your `$PATH`. Add the following line to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.):
825

926
``` bash
10-
mkdir -p ~/.local/bin/
11-
wget https://raw.githubusercontent.com/MrSloth-dev/eZmux/refs/heads/main/zmux -O ~/.local/bin/zmux
12-
chmod u+x ~/.local/bin/zmux
13-
# Add to .bashrc or .zshrc or add /.local/bin to $PATH
14-
# echo 'alias zmux="~/.local/bin/zmux"' >> ~/.zshrc
15-
export PATH=$PATH:~/.local/bin/
16-
source ~/.zshrc
27+
export PATH=$PATH:~/.local/bin # Replace with your chosen directory
28+
```
29+
Then reload your shell:
30+
```bash
31+
source ~/.zshrc # or ~/.bashrc
32+
```
33+
### Step 3: Verify Instalation
34+
Check if Zmux is installed correctly
35+
```bash
36+
zmux -v
1737
```
1838

19-
## Dependencies
39+
## Dependencies ⚙️
2040

2141
- `tmux` version greater or equal to `v3.3`.
2242
- `yq` version greater or equal to `v4.44.6`. This tool allows the configuration parsing.
2343
- `fzf` This tool allows quick and interactive listing of all pre-configured and opened sessions.
2444
- `yamllint` This tool check if configuration files are well formatted.
2545

26-
# Usage
46+
## Usage 🛠️
2747

28-
The main goal of this script is to be simple, there are two ways of invoking the script:
29-
- `zmux` will spawn a `fzf` window that list all active and pre-configured sessions.
48+
Zmux is designed to be simple and intuitive. You can use it in several ways:
49+
50+
### List and Select Sessions
51+
52+
Run zmux without any arguments to open an interactive fzf window. This lists all active and pre-configured sessions.
3053

3154
![img](assets/preview.png)
3255

33-
**Note**: Press Ctrl-t to toggle the `fzf` preview-window.
56+
Press Ctrl-t to toggle the preview window, which shows detailed information about the selected session, including:
57+
58+
- Session status (active/inactive).
59+
60+
- Configured windows and panes.
61+
62+
- Layouts and commands for each pane.
63+
64+
### Open or Create a Specific Session
65+
66+
Run `zmux <session-name>` to open or create a specific session. If the session does not exist, Zmux will prompt you to create it.
67+
- If the session is pre-configured in your YAML files, Zmux will create the session with the specified windows, panes, and commands.
68+
69+
- If the session does not exist, Zmux will create a new session with the given name.
70+
71+
### Export Current Session Configuration
72+
73+
Use the -e or --export flag to export the current session configuration to a YAML file. This is useful for saving session setups for future use.
74+
75+
- Zmux will prompt you to select a configuration file or create a new one.
76+
77+
- The exported configuration will include:
78+
79+
- Root directory.
80+
81+
- Windows and their respective panes.
82+
83+
- Commands for each pane.
84+
85+
### Kill Session or Server
3486

35-
- `zmux <sesison-name>` will search if session is active or exist in configuration files. If not, it prompts the user to create a new session.
87+
Use the `-k <session-name>` or --kill flag to kill the selected session. To kill the Tmux server and close all sessions use `-k all`
3688

37-
- `zmux -k` or `--kill` to kill the `tmux` server
89+
### Check Configuration Files
3890

39-
- `zmux -e` or `--export` to export the current session into a `YAML` file
91+
Use the `-c` or `--check` flag to validate your YAML configuration files with `yamllint`.
92+
- This ensures your configuration files are well-formatted and free of errors.
4093

41-
- `zmux -c` or `--check` to the `YAML` configuration file and ouputs if found any errors.
94+
### Print Help
4295

43-
- `zmux -h` or `--help` to print the help message
96+
Use the `-h` or `--help` flag to display the help message.
4497

45-
- `zmux -v` or `--version` to print the version
98+
### Using Split (v0.4.0+)
4699

47-
# Configuration
100+
You can now configure splits (panes) within windows in your session configuration. Each window can have multiple panes with customizable layouts and commands.
101+
102+
### Example Configuration
103+
104+
``` yaml
105+
sessions:
106+
project_a:
107+
root: ~/Projects/ProjectA/
108+
windows:
109+
- name: Editor
110+
layout: tiled # Supported layouts: tiled, even-horizontal, even-vertical
111+
panes:
112+
- command: nvim .
113+
- command: htop
114+
- name: Server
115+
layout: even-vertical
116+
panes:
117+
- command: npm run dev
118+
- command: tail -f logs.txt
119+
```
120+
### Supported Layouts
121+
- tiled : Panes are arranged in a grid.
122+
- even-horizontal : Panel are arranged horizontally with equal width.
123+
- even-vertical : Panel are arranged horizontally with equal height.
124+
- main-horizontal : Panel are arranged horizontally with equal height but the first index, this will occupy half of the screen.
125+
- main-vertical : Panel are arranged horizontally with equal width but the first index, this will occupy half of the screen.
126+
127+
128+
## Configuration ⚙️
48129
49130
All configurations will be sourced in `YAML` format under `~/.config/zmux/` directory.
50131

@@ -57,31 +138,38 @@ You can have multiple sessions pre-configured in each file:
57138
└── server.yaml # Server management sessions
58139
```
59140

60-
For a basic session:
141+
Example session:
61142

62143
``` yaml
63144
sessions:
64145
project_a:
65146
root: ~/Projects/ProjectA/
66147
windows:
67148
- name: Editor
68-
command: nvim .
69-
- name: Terminal
70-
command: ls
71-
project_b:
72-
root: ~/Projects/ProjectB/
73-
windows:
74-
- name: Code
75-
command: nvim main.cpp
76-
- name: compiling
77-
command: echo hello
78-
- name: README.md
79-
command: nvim README.md
149+
layout: tiled
150+
panes:
151+
- command: nvim .
152+
- command: htop
153+
- name: Server
154+
layout: even-vertical
155+
panes:
156+
- command: npm run dev
157+
- command: tail -f logs.txt
80158
```
159+
### Key Fields 🔑
160+
- root: Root directory for the session.
161+
162+
- windows: List of windows.
81163

82-
Note: For now, there isn't layout and split panes but will be implemented.
164+
- name: Window name.
83165

84-
# Roadmap | TODO
166+
- command: Command to run in the window (or pane).
167+
168+
- layout: (Optional) Layout for splits. Supported: tiled, even-horizontal, even-vertical. (v0.4.0+)
169+
170+
- panes: (Optional) List of panes for splits. Each pane can have a command. (v0.4.0+)
171+
172+
## Roadmap | TODO 🗺️
85173
- [x] Create Session with `zmux <session_name>`
86174
- [x] Assign root directory
87175
- [x] Create Normal Windows and rename them
@@ -93,14 +181,31 @@ Note: For now, there isn't layout and split panes but will be implemented.
93181
- [x] Use multiple files instead of only `config.yaml`
94182
- [x] Configuration Checker
95183
- [x] Preview windows in fzf list
96-
- [ ] Splits
97-
- [ ] Different Layouts
98-
- [ ] CI and testing to make sure it doesn't break anything
184+
- [x] Splits!
185+
- [x] Different Layouts!
186+
- [x] CI and testing to make sure it doesn't break anything
99187
- [ ] Sugestions are welcome!
100188

101-
# Changelog
189+
## Changelog 📜
190+
191+
### [0.4.0] - 2024-01-31
192+
193+
#### Added
194+
- Splits Support: Now you can configure splits (panes) within windows in your session configuration.
195+
- Improved Preview in `fzf`: The preview window now shows detailed information about splits.
196+
- Session Kill: Now you can kill a specific session with `zmux -k <session-name>` or kill the server `zmux -k all`
197+
198+
#### Changed
199+
- Configuration Format: The `windows` section now supports a `panes` field for defining splits.
200+
- Error Handling: Improved error messages for invalid split configurations.
201+
202+
#### Bugfix
203+
- Fixed an issue where the `root` directory was not being correctly set for panes.
204+
- Fixed a bug where the `fzf` preview window would not display pane information correctly.
205+
- Fixed an issue when export into a new file the `sessions:` header was missing
102206

103-
### [0.3.2] - 2025-1-17
207+
208+
### [0.3.2] - 2025-01-17
104209

105210
### Added
106211

@@ -112,7 +217,8 @@ Note: For now, there isn't layout and split panes but will be implemented.
112217

113218
- Correct the file list when creating new file through export, now also follows symbolic links.
114219

115-
### [0.3.1] - 2025-1-16
220+
221+
### [0.3.1] - 2025-01-16
116222

117223
### Added
118224

@@ -127,13 +233,15 @@ Note: For now, there isn't layout and split panes but will be implemented.
127233

128234
- Sometimes the yaml generated text was badly formatted.
129235

130-
### [0.3] - 2025-1-3
236+
237+
### [0.3] - 2025-01-03
131238

132239
### Added
133240

134241
- Added support for multiple configuration files, now you can do it like this:
135242
- Added window Preview when seeing in `fzf list` , can press `ctrl-t` to toggle preview-window.
136243

244+
137245
### [0.2] - 2024-12-29
138246

139247
### Added
@@ -150,6 +258,7 @@ Note: For now, there isn't layout and split panes but will be implemented.
150258
- Now `session_name` can only have alphanumeric, underscore and hyphen.
151259
- If there wasn't any sessions in config file `zmuz` didn't work.
152260

261+
153262
### [0.1.1] - 2024-12-22
154263

155264
### Bugfix
@@ -158,6 +267,7 @@ Note: For now, there isn't layout and split panes but will be implemented.
158267
- Fixed error when user inserted an non existent and not configured session name.
159268
- Root folder wasn't being set correctly.
160269

270+
161271
### [0.1] - 2024-12-14
162272

163273
### Added
@@ -167,5 +277,5 @@ Note: For now, there isn't layout and split panes but will be implemented.
167277
- It fetch the preconfigured sessions in '~/.config/zmux/config.yaml'
168278
- When Selected, it create/opens the session.
169279

170-
## License
280+
## License 📄
171281
MIT

0 commit comments

Comments
 (0)