From 2ca117012379e3b8246f759223febff68c40b9e8 Mon Sep 17 00:00:00 2001 From: xcko Date: Fri, 27 Jul 2018 20:04:17 +0000 Subject: solarized themed terms do not need bg and fg set again --- lua/themes/solarized.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua') diff --git a/lua/themes/solarized.lua b/lua/themes/solarized.lua index a5d4c4d..7f40858 100644 --- a/lua/themes/solarized.lua +++ b/lua/themes/solarized.lua @@ -27,6 +27,10 @@ local bg = ',back:'..colors.base03..',' -- light -- local fg = ',fore:'..colors.base03..',' -- local bg = ',back:'..colors.base3..',' +-- solarized term +-- local fg = ',fore:default,' +-- local bg = ',back:default,' + lexers.STYLE_DEFAULT = bg..fg lexers.STYLE_NOTHING = bg -- cgit v1.2.3 From 0eb675b33fdc309b5124b4164b5333ef4a64a1d8 Mon Sep 17 00:00:00 2001 From: Silas Date: Mon, 11 Mar 2019 11:15:23 -0300 Subject: Heredoc delimiter should end with a newline Or else the following: < Date: Wed, 26 Jun 2019 12:34:35 -0700 Subject: filetype: Match known filenames exactly Otherwise, a file like `passwd.c` will match both ansi_c and dsv. The one that gets chosen depends on the iteration order of table, which is non-deterministic. --- lua/plugins/filetype.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 6c574bc..35912f6 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -102,13 +102,13 @@ vis.ftdetect.filetypes = { ext = { "%.d$", "%.di$" }, }, dockerfile = { - ext = { "Dockerfile" }, + ext = { "^Dockerfile$", "%.Dockerfile$" }, }, dot = { ext = { "%.dot$" }, }, dsv = { - ext = { "group", "gshadow", "passwd", "shadow" }, + ext = { "^group$", "^gshadow$", "^passwd$", "^shadow$" }, }, eiffel = { ext = { "%.e$", "%.eif$" }, @@ -282,7 +282,7 @@ vis.ftdetect.filetypes = { ext = { "%.pike$", "%.pmod$" }, }, pkgbuild = { - ext = { "PKGBUILD" }, + ext = { "^PKGBUILD$" }, }, pony = { ext = { "%.pony$" }, -- cgit v1.2.3 From 807ba6f6850bf7dbf86fd65299248f2d9cba7f75 Mon Sep 17 00:00:00 2001 From: zsugabubus Date: Sun, 12 Jan 2020 12:18:01 +0100 Subject: lexers: match whitespaces in text lexer Otherwise, show-{tabs,newlines,spaces} replacement characters are undistinguishable from normal text. --- lua/lexers/text.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lua') diff --git a/lua/lexers/text.lua b/lua/lexers/text.lua index 4988d95..cc41bfa 100644 --- a/lua/lexers/text.lua +++ b/lua/lexers/text.lua @@ -1,6 +1,15 @@ -- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE. -- Text LPeg lexer. +local l = require('lexer') + local M = {_NAME = 'text'} +-- Whitespace. +local ws = l.token(l.WHITESPACE, l.space^1) + +M._rules = { + {'whitespace', ws}, +} + return M -- cgit v1.2.3 From febe0528303f838fa9f346aa343fff0fe29f5ba3 Mon Sep 17 00:00:00 2001 From: zsugabubus Date: Sun, 12 Jan 2020 12:27:39 +0100 Subject: filetype: try text lexer as a last resort --- lua/plugins/filetype.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lua') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 35912f6..c7fad69 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -385,6 +385,10 @@ vis.ftdetect.filetypes = { texinfo = { ext = { "%.texi$" }, }, + text = { + ext = { "%.txt$" }, + mime = { "text/plain" }, + }, toml = { ext = { "%.toml$" }, }, @@ -497,6 +501,12 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) end end + -- try text lexer as a last resort + if (mime or 'text/plain'):match('^text/.+$') then + set_filetype('text', vis.ftdetect.filetypes.text) + return + end + win:set_syntax(nil) end) -- cgit v1.2.3 From aa526ad03807cf964671ae9d36c4311f0219e567 Mon Sep 17 00:00:00 2001 From: Georgi Kirilov Date: Tue, 15 Oct 2019 00:09:16 +0300 Subject: lexers: add Fennel support --- lua/lexers/fennel.lua | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ lua/plugins/filetype.lua | 3 ++ 2 files changed, 91 insertions(+) create mode 100644 lua/lexers/fennel.lua (limited to 'lua') diff --git a/lua/lexers/fennel.lua b/lua/lexers/fennel.lua new file mode 100644 index 0000000..ee8127c --- /dev/null +++ b/lua/lexers/fennel.lua @@ -0,0 +1,88 @@ +-- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE. +-- Lua LPeg lexer. +-- Original written by Peter Odding, 2007/04/04. + +local l = require('lexer') +local token, word_match = l.token, l.word_match +local P, R, S = lpeg.P, lpeg.R, lpeg.S + +local M = {_NAME = 'fennel'} + +-- Whitespace. +local ws = token(l.WHITESPACE, l.space^1) + +-- Comments. +local line_comment = ';' * l.nonnewline^0 +local comment = token(l.COMMENT, line_comment) + +-- Strings. +local dq_str = l.delimited_range('"') +local string = token(l.STRING, dq_str) + +-- Numbers. +local lua_integer = P('-')^-1 * (l.hex_num + l.dec_num) +local number = token(l.NUMBER, l.float + lua_integer) + +-- Keywords. +local keyword = token(l.KEYWORD, word_match({ + '%', '*', '+', '-', '->', '->>', '-?>', '-?>>', '.', '..', '/', '//', ':', '<', '<=', '=', '>', '>=', '^', '~=', 'λ', + 'and', 'comment', 'do', 'doc', 'doto', 'each', 'eval-compiler', 'fn', 'for', 'global', 'hashfn', 'if', 'include', 'lambda', + 'length', 'let', 'local', 'lua', 'macro', 'macros', 'match', 'not', 'not=', 'or', 'partial', 'quote', 'require-macros', + 'set', 'set-forcibly!', 'tset', 'values', 'var', 'when', 'while' +}, "%*+-./:<=>?~^λ!")) + +-- Libraries. +local library = token('library', word_match({ + -- Coroutine. + 'coroutine', 'coroutine.create', 'coroutine.resume', 'coroutine.running', + 'coroutine.status', 'coroutine.wrap', 'coroutine.yield', + -- Module. + 'package', 'package.cpath', 'package.loaded', 'package.loadlib', + 'package.path', 'package.preload', + -- String. + 'string', 'string.byte', 'string.char', 'string.dump', 'string.find', + 'string.format', 'string.gmatch', 'string.gsub', 'string.len', 'string.lower', + 'string.match', 'string.rep', 'string.reverse', 'string.sub', 'string.upper', + -- Table. + 'table', 'table.concat', 'table.insert', 'table.remove', 'table.sort', + -- Math. + 'math', 'math.abs', 'math.acos', 'math.asin', 'math.atan', 'math.ceil', + 'math.cos', 'math.deg', 'math.exp', 'math.floor', 'math.fmod', 'math.huge', + 'math.log', 'math.max', 'math.min', 'math.modf', 'math.pi', 'math.rad', + 'math.random', 'math.randomseed', 'math.sin', 'math.sqrt', 'math.tan', + -- IO. + 'io', 'io.close', 'io.flush', 'io.input', 'io.lines', 'io.open', 'io.output', + 'io.popen', 'io.read', 'io.stderr', 'io.stdin', 'io.stdout', 'io.tmpfile', + 'io.type', 'io.write', + -- OS. + 'os', 'os.clock', 'os.date', 'os.difftime', 'os.execute', 'os.exit', + 'os.getenv', 'os.remove', 'os.rename', 'os.setlocale', 'os.time', + 'os.tmpname', + -- Debug. + 'debug', 'debug.debug', 'debug.gethook', 'debug.getinfo', 'debug.getlocal', + 'debug.getmetatable', 'debug.getregistry', 'debug.getupvalue', + 'debug.sethook', 'debug.setlocal', 'debug.setmetatable', 'debug.setupvalue', + 'debug.traceback', +}, '.')) + +local initial = l.alpha + S"|$%&#*+-./:<=>?~^_λ!" +local subsequent = initial + l.digit + +-- Identifiers. +local identifier = token(l.IDENTIFIER, initial * subsequent^0) + +M._rules = { + {'whitespace', ws}, + {'keyword', keyword}, + {'library', library}, + {'identifier', identifier}, + {'string', string}, + {'comment', comment}, + {'number', number} +} + +M._tokenstyles = { + library = l.STYLE_TYPE, +} + +return M diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 35912f6..601bfa2 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -125,6 +125,9 @@ vis.ftdetect.filetypes = { faust = { ext = { "%.dsp$" }, }, + fennel = { + ext = { "%.fnl$" }, + }, fish = { ext = { "%.fish$" }, }, -- cgit v1.2.3