From 6d1d45776b231304b0ff41b5e6098f07931ec44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 8 Dec 2016 09:06:01 +0100 Subject: lua: add simple event multiplexing mechanism The editor core calls into the functions registered in the `vis.events` table which then multiplex the events to all registered event handlers. The first handler which returns a non `nil` value terminates event propagation. --- lua/plugins/filetype.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index e308ac0..7101e4c 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -356,7 +356,7 @@ vis.ftdetect.filetypes = { }, } -vis.filetype_detect = function(win) +vis.events.subscribe(vis.events.WIN_OPEN, function(win) local name = win.file.name -- remove ignored suffixes from filename local sanitizedfn = name @@ -425,5 +425,5 @@ vis.filetype_detect = function(win) end win.syntax = nil -end +end) -- cgit v1.2.3