Skip to content

Commit adb0bb6

Browse files
committed
docs: added layout feature
1 parent f781d21 commit adb0bb6

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ A simple plugin for [taskfiles](https://taskfile.dev/)
1313
- Run tasks in a floating terminal
1414
- Automatically scroll to bottom of output (optional)
1515
- Rerun last task via command or key-map
16-
- Flexible layout with width_ratio or auto-sizing to fit
17-
task names and descriptions neatly
16+
- Flexible layouts:
17+
- **Horizontal**: task list and preview side-by-side
18+
- **Vertical**: task list stacked above preview
19+
- Configurable `width_ratio` / `height_ratio` or automatic sizing
20+
to neatly fit task names and descriptions
21+
- Toggle between horizontal and vertical layouts at runtime
1822

1923
## Requirements
2024

@@ -39,6 +43,9 @@ All fields are optional and shown below with their default values:
3943

4044
```lua
4145
require('taskfile').setup({
46+
layout = "horizontal", -- Layout: 'h', 'horiz', 'horizontal' or 'v', 'vert', 'vertical'.
47+
-- For 'horizontal' layout, list and preview are side-by-side.
48+
-- For 'vertical', list is above preview (vertically stacked).
4249
windows = {
4350
output = { -- Task output window
4451
width = 0.8, -- Width of the window (percentage of editor width)
@@ -48,11 +55,18 @@ require('taskfile').setup({
4855
list = { -- Task list and preview window
4956
width = 0.6,
5057
height = 0.4,
51-
border = "rounded"
58+
border = "rounded",
59+
-- only used for horizontal layout
5260
width_ratio = 0, -- Ratio (0–1) of list vs preview width.
5361
-- If set, determines how much space is given to the list.
5462
-- If unset or 0, the list width is calculated to fit
5563
-- longest task name and description without wrapping.
64+
-- only used for vertical layout
65+
height_ratio = 0, -- Ratio (0–1) of list vs preview height.
66+
-- If set, determines how much space is given to the list.
67+
-- If unset or 0, the list height is calculated to fit
68+
-- the rendered task lines (name + description),
69+
-- wrapping as needed, without overflow.
5670
},
5771
},
5872
scroll = {
@@ -73,6 +87,8 @@ This plugin reads your Taskfile and displays available tasks.
7387
- `:Task <task_name>`: Run a specific task by name
7488
- `:Task`: Show a floating task selector with preview
7589
- `:TaskRerun`: Rerun the last executed task
90+
- `:TaskToggleLayout`: Toggles the layout for the current Neovim session.
91+
On restart, it resets to your configured default.
7692

7793
You can also bind a key to rerun using the `keymaps.rerun` config.
7894

demo/demo.gif

271 KB
Loading

demo/demo.tape

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Set MarginFill "#3D4262"
88
Set BorderRadius 7
99

1010

11-
Set Width 1600
11+
Set Width 1440
1212
Set Height 900
13-
Set FontSize 14
13+
Set FontSize 16
1414

1515
Hide
1616
Type "cd $HOME/git/examples/go-web-app"
@@ -27,6 +27,11 @@ Sleep 750ms
2727
Enter
2828
Sleep 750ms
2929

30+
Type ":TaskToggleLayout"
31+
Sleep 500ms
32+
Enter
33+
Sleep 500ms
34+
3035
Type "j"
3136
Sleep 1000ms
3237
Enter
@@ -45,6 +50,11 @@ Sleep 1000ms
4550
Enter
4651
Sleep 1000ms
4752

53+
Type ":TaskToggleLayout"
54+
Sleep 500ms
55+
Enter
56+
Sleep 500ms
57+
4858
Type "j"
4959
Sleep 500ms
5060
Type "j"

0 commit comments

Comments
 (0)