Skip to content

Commit e58548c

Browse files
committed
✨ Add some vi-friendly navigation to the navigation panel
1 parent 3d5ed4b commit e58548c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Hike ChangeLog
22

3+
## Unreleased
4+
5+
**Released: WiP**
6+
7+
- Added some vi-friendly navigation to the navigation panel.
8+
39
## v0.11.1
410

511
**Released: 2025-04-12**

src/hike/widgets/navigation/widget.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ class Navigation(Vertical):
8383
"switch('next_tab')",
8484
tooltip="Move to the next navigation tab",
8585
),
86+
("h", "tab_left"),
87+
("j", "also_down"),
88+
("k", "also_up"),
89+
("l", "tab_right"),
8690
]
8791

8892
HELP = """
@@ -283,5 +287,27 @@ def jump_to_history(self) -> None:
283287
if self.query_one(HistoryView).option_count:
284288
self._activate("history")
285289

290+
async def action_also_down(self) -> None:
291+
"""Hack in some extra cursor down support."""
292+
if isinstance(self.screen.focused, Tree):
293+
await self.screen.focused.run_action("cursor_down")
294+
else:
295+
await self.run_action("move_into_panel")
296+
297+
async def action_also_up(self) -> None:
298+
"""Hack in some extra cursor up support."""
299+
if isinstance(self.screen.focused, Tree):
300+
await self.screen.focused.run_action("cursor_up")
301+
302+
async def action_tab_left(self) -> None:
303+
"""Hack in some extra cursor left support."""
304+
if query := self.query("Tabs:focus"):
305+
await query[0].run_action("previous_tab")
306+
307+
async def action_tab_right(self) -> None:
308+
"""Hack in some extra cursor right support."""
309+
if query := self.query("Tabs:focus"):
310+
await query[0].run_action("next_tab")
311+
286312

287313
### navigation.py ends here

0 commit comments

Comments
 (0)