doc: update event subscription example

This commit is contained in:
Alexander Courtis 2022-10-31 13:59:03 +11:00
parent 3845039c1a
commit 1044eba9e7

View File

@ -1426,9 +1426,10 @@ Handlers are registered by calling the `events.subscribe` function available in
For example, registering a handler for when a node is renamed is done like this:
>
local api = require('nvim-tree.api')
local Event = api.events.Event
api.events.subscribe(Event.NodeRenamed, function(data)
print("Node renamed from " .. data.old_name .. " to " .. data.new_name)
print("Node renamed from " .. data.old_name .. " to " .. data.new_name)
end)
<