Skip to content

Commit

Permalink
Update readme and command documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
distek committed Feb 22, 2024
1 parent d234288 commit 3e25ced
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 22 deletions.
62 changes: 51 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,39 @@ Pane movement. Not perfect but does it well enough for my use. Will probably imp

`tmux-tools wm [up|down|left|right]`

#### TODO
TODO:

- [ ] It would be nice if neighbors swapped instead of moved I think? Or an option to swap? idk

---

### `nest`

Nested tmux session with auto-close. I use this in neovim config for my toggle terminal so I can have multiple term tabs.

`tmux-tools nest --tmux-config <path to nested.conf>`

In my nested config, I have special remaps setup so it doesn't interfere with the parent tmux mappings
In my nested config, I have special remaps setup so it doesn't interfere with the parent tmux mappings:

- Normal config:

```
source-file ~/.config/tmux/common.conf
unbind C-b
set -g prefix M-Space;
```

- Nested config:

```
source-file ~/.config/tmux/common.conf
unbind C-b
set -g prefix M-a;
```

---

### `sessions`

Expand All @@ -41,22 +63,40 @@ sessions:
- "man"
```
- asks for name of session
`tmux-tools sessions save`
Asks for name of session:
- save session as provided name
`tmux-tools sessions save --name <name>`
`tmux-tools sessions save`

- load session by provided name
`tmux-tools sessions load --name <name>`
Save session as provided name:

- load session by `fzf` (requires `fzf` binary be in PATH)
`tmux-tools sessions load`
`tmux-tools sessions save --name <name>`

#### TODO
Load session by provided name:

`tmux-tools sessions load --name <name>`

Load session by `fzf` (requires `fzf` binary be in PATH):

`tmux-tools sessions load`

TODO:

- [ ] Should kill new session if restoring fails

---

### `clean`

Kills all non-`(attached)` sessions on `-S` socket

---

### `focus-pane`

Focus pane in a given direction:

`tmux-tools focus-pane {left | down | up | right}`

## TODO

- [ ] Standardize logging (style/formatting) across the tool
5 changes: 3 additions & 2 deletions cmd/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ var cleanCmd = &cobra.Command{
}

var focusPaneCmd = &cobra.Command{
Use: "focus-pane",
Short: "",
Use: "focus-pane {left | down | up | right}",
Short: "Focus pane in a given direction (left, down, up, right)",
ValidArgs: []string{"left", "down", "up", "right"},
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
Run: func(cmd *cobra.Command, args []string) {
dir := args[0]

Expand Down
11 changes: 2 additions & 9 deletions cmd/wm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
)

var wmCmd = &cobra.Command{
Use: "wm",
Use: "wm {left | down | up | right}",
Short: "Window manager",
ValidArgs: []string{"left", "down", "up", "right"},
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
log.Printf("Provide only one of %v", cmd.ValidArgs)
Expand All @@ -22,14 +23,6 @@ var wmCmd = &cobra.Command{

dir := args[0]

switch dir {
case "left", "down", "up", "right":
default:
log.Printf("Provide only one of %v", cmd.ValidArgs)
_ = cmd.Usage()
os.Exit(1)
}

moveWindowInDir(dir)
},
}
Expand Down

0 comments on commit 3e25ced

Please sign in to comment.