1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- Trail bookmarks example plugin
--
-- Demonstrates the `register_action` hook by implementing `:bookmark` and
-- `:jump <name>` as plugin-registered actions that delegate to Trail's
-- built-in bookmark store.
--
-- This plugin is loaded automatically when the `bookmarks` entry is present
-- in `[plugins].enabled` in the user's `trail.toml`.
--
-- Actions registered by this plugin:
-- `:plugin bookmark [name]` — add a bookmark at the current directory.
-- `:plugin jump <name>` — navigate to a previously added bookmark.
--
-- Note: In v1 the plugin receives the path as a string argument from Trail.
-- Full two-way interaction (e.g. reading AppState, navigating) is a v2 goal.
trail.
-- Track the current directory via on_enter_dir so actions can use it.
local current_dir = ""
trail.
trail.
-- register_action registers a named verb that the command parser will
-- dispatch when the user types `:plugin <name> [arg]`.
trail.
trail.