From d5c8feba9a0f4b460a993aec13abe0e2a1534340 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Wed, 4 Oct 2017 15:11:16 +0200 Subject: [PATCH] add visrc and lithaskell lexer --- config/vis/lexers/lithaskell.lua | 18 ++++++++++++++++++ config/vis/plugins/myfiletype.lua | 5 +++++ config/vis/visrc.lua | 27 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 config/vis/lexers/lithaskell.lua create mode 100644 config/vis/plugins/myfiletype.lua create mode 100644 config/vis/visrc.lua diff --git a/config/vis/lexers/lithaskell.lua b/config/vis/lexers/lithaskell.lua new file mode 100644 index 0000000..cf2198b --- /dev/null +++ b/config/vis/lexers/lithaskell.lua @@ -0,0 +1,18 @@ +local l = require('lexer') +local token = l.token +local S = lpeg.S + +local M = {_NAME = 'lithaskell'} + +local haskell = l.load('haskell') +local start_rule = token(l.STYLE_EMBEDDED, l.starts_line(S('><'))) +local end_rule = token(l.STYLE_EMBEDDED, l.newline) + +local line = token(l.COMMENT, l.nonnewline^1) +M._rules = { + { 'comment', line } +} + +l.embed_lexer(M, haskell, start_rule, end_rule) + +return M \ No newline at end of file diff --git a/config/vis/plugins/myfiletype.lua b/config/vis/plugins/myfiletype.lua new file mode 100644 index 0000000..4f9ed75 --- /dev/null +++ b/config/vis/plugins/myfiletype.lua @@ -0,0 +1,5 @@ +require("plugins/filetype") + +vis.ftdetect.filetypes["lithaskell"] = { + ext = { "%.lhs$" }, +} diff --git a/config/vis/visrc.lua b/config/vis/visrc.lua new file mode 100644 index 0000000..5ac9b69 --- /dev/null +++ b/config/vis/visrc.lua @@ -0,0 +1,27 @@ +-- load standard vis module, providing parts of the Lua API +require('vis') +require('plugins/complete-word') +require('plugins/myfiletype') + +vis.events.subscribe(vis.events.INIT, function() + -- Your global configuration options +end) + +vis.events.subscribe(vis.events.WIN_OPEN, function(win) + -- Your per window configuration options e.g. + -- vis:command('set number') + vis:command('set tabwidth 4') + vis:command('set autoindent on') + vis:command('set expandtab on') + vis:command('set show-tabs on') + vis:command('set number') + vis:command('set theme dark-16') +end) + +vis:map(vis.modes.NORMAL, ";l", function() + local out = io.popen("fzf"):read() + if out then + vis:command(string.format('open %s', out)) + end + vis:feedkeys(" ") +end)