feat(api): expose generic "*_to" functions#141
Conversation
There was a problem hiding this comment.
Pull request overview
This PR exposes generic direction-based APIs (e.g., *_to) in the public tmux Lua module to allow consumers (like Neovim configs) to call move/resize/swap operations with a runtime direction instead of dedicated per-direction functions.
Changes:
- Add
move_to(direction)as a generic navigation wrapper. - Add
resize_to(direction, step)as a generic resize dispatcher. - Export
swap_to(direction)via the top-leveltmuxmodule and document these APIs in the README.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| README.md | Documents the new generic *_to APIs and updates resize examples to show optional step usage. |
| lua/tmux/resize.lua | Adds M.to(direction, step) dispatcher that routes to to_left/to_bottom/to_top/to_right. |
| lua/tmux/navigation/init.lua | Adds M.to(direction) wrapper calling into navigate.to(direction). |
| lua/tmux/init.lua | Exposes move_to, resize_to, and swap_to on the public require("tmux") API surface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
omfg this bs copilot review. im sorry. |
|
disabled.. |
|
hmm, im unsure about this one. it abstracts the motion away by hjkl and is not really verbose. i would go with e.g. *_to('left'), but this will not help you either :D |
|
WDYM by abstracting from hjkl? Current API does not focus on these nvim commands either, only left/right/top/bottom. I can replace direction arg with more verbose |
sry, not a native speaker :D and yes, exactly that was what i meant. |
| end | ||
|
|
||
| function M.to(direction) | ||
| function M._to(direction) |
There was a problem hiding this comment.
since this api is changing to be consinstent with other to directions, add the mapping from direction to hjkl directly here and rework the calls inside to_left...
thus, we have a clean api and not .to and ._to which can be confusing.
| M._to("l") | ||
| end | ||
|
|
||
| -- Note: this function is exposed to public API and uses "left/right/top/bottom" as direction, |
There was a problem hiding this comment.
remove all comments. they are redundant.
|
I pushed diff as a separate commit (if that is what you asked). |
|
coverage decreases. please add specs accordinly. kind regards |
|
Done, I think |
I have a little annoying move and resize dispatchers in neovim config, which could be avoided if I could have access to generic navigation.