aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-08 09:06:01 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-08 09:11:59 +0100
commit6d1d45776b231304b0ff41b5e6098f07931ec44e (patch)
tree2f7f41170491200d5da92bf4cd570a3e268fbed2 /lua/plugins
parent065a804d282ac99dd93e9ebaf7bc986ccf53e75b (diff)
downloadvis-6d1d45776b231304b0ff41b5e6098f07931ec44e.tar.gz
vis-6d1d45776b231304b0ff41b5e6098f07931ec44e.tar.xz
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.
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/filetype.lua4
1 files changed, 2 insertions, 2 deletions
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)