vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 91d404c65b411c5a715b4f73589f20a98afe7000
parent ee5405bd856989afe0ce5581f1608c44fd0ef680
Author: Josh Wainwright <wainwright.ja@gmail.com>
Date:   Wed, 23 Mar 2016 11:12:54 +0000

visrc: Move filetype detection to separate function

I hadn't noticed the `return;` line when a filetype match is found so
couldn't get my additions to this function to work. Moving the detection
to a separate function keeps that isolated and indicates that other
functions can be called from the same `vis.events.win_open` hook.

Diffstat:
Mvisrc.lua | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/visrc.lua b/visrc.lua @@ -67,8 +67,7 @@ vis:textobject_new("ii", function(win, pos) return pos, pos end) -vis.events.win_open = function(win) - +local set_filetype = function(win) local files = { [".1|.2|.3|.4|.5|.6|.7|.8|.9|.1x|.2x|.3x|.4x|.5x|.6x|.7x|.8x|.9x"] = "man", [".au3|.a3x"] = "autoit", @@ -198,5 +197,11 @@ vis.events.win_open = function(win) end win.syntax = nil +end + +vis.events.win_open = function(win) + set_filetype(win) + -- eg Turn on line numbering + -- vis:command('set number') end