diff options
| author | iceyrazor <iceyrazor@mailfence.com> | 2026-06-04 11:51:38 -0500 |
|---|---|---|
| committer | iceyrazor <iceyrazor@mailfence.com> | 2026-06-04 11:51:38 -0500 |
| commit | 4567ec7e1281cae3feba3f2fb827f8cfbabf48f1 (patch) | |
| tree | e50dcf6fb9706d7944f83389a175d3ea6fed2589 /env/.config/vis | |
| parent | cffb4360557e74eb4ace93f9903965819c9b0689 (diff) | |
Squashed commit of the following:
ps1 change
vis bind to lf
cleaned up vis plugins
added greyscript language server
added asciidoc vis lexer
Diffstat (limited to 'env/.config/vis')
| -rw-r--r-- | env/.config/vis/lexers/asciidoc.lua | 33 | ||||
| -rw-r--r-- | env/.config/vis/lexers/greyscript.lua | 33 | ||||
| -rw-r--r-- | env/.config/vis/plugins.lua | 27 | ||||
| -rw-r--r-- | env/.config/vis/visrc.lua | 1 |
4 files changed, 86 insertions, 8 deletions
diff --git a/env/.config/vis/lexers/asciidoc.lua b/env/.config/vis/lexers/asciidoc.lua new file mode 100644 index 0000000..83d080b --- /dev/null +++ b/env/.config/vis/lexers/asciidoc.lua @@ -0,0 +1,33 @@ +local lexer = require('lexer') +local token, word_match = lexer.token, lexer.word_match +local P, S, B = lpeg.P, lpeg.S, lpeg.B + +local lex = lexer.new('asciidoc') + +-- AsciiDoc blocks: ==== and ---- +local adoc_block = lexer.range('====', '====', true, true, true) + lexer.range('----', '----', true, true, true) +lex:add_rule('block', token(lexer.PREPROCESSOR, lexer.range('====', '====', true, true, true) + lexer.range('----', '----', true, true, true))) +--lex:add_rule('block', token(lexer.EMPH, adoc_block)) + +-- Block: ---- must match full line +--lex:add_rule('block', token(lexer.EMPH, P('----') * P('\n') * (lexer.any - P('----'))^0 * P('----'))) + +-- Headers: Must be at start of line +lex:add_rule('header', token(lexer.KEYWORD, B('\n')^-1 * P('=')^1 * ' ' * lexer.nonnewline^1)) + +-- Bold: Prevent overlap with other syntax +lex:add_rule('bold', token(lexer.BOLD, P('*') * (lexer.any - S('*\n'))^1 * P('*'))) + +-- Italic +lex:add_rule('italic', token(lexer.ITALIC, P('_') * (lexer.any - S('_\n'))^1 * P('_'))) + +-- Links +lex:add_rule('link', token(lexer.CONSTANT, 'https?://' * lexer.nonnewline^1)) + +-- Comments +lex:add_rule('comment', token(lexer.COMMENT, P('//') * lexer.nonnewline^0)) + +-- Identifier (last) +lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) + +return lex diff --git a/env/.config/vis/lexers/greyscript.lua b/env/.config/vis/lexers/greyscript.lua new file mode 100644 index 0000000..93f8359 --- /dev/null +++ b/env/.config/vis/lexers/greyscript.lua @@ -0,0 +1,33 @@ +local lexer = require('lexer') +local token, word_match = lexer.token, lexer.word_match +local P, S = lpeg.P, lpeg.S + +-- Create the lexer object +local lex = lexer.new('greyscript') + +-- 1. Whitespace +lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) + +-- 2. Keywords (Add your language keywords here) +lex:add_rule('keyword', token(lexer.KEYWORD, word_match[[ + if then else end function return local +]])) + +-- 3. Identifiers +lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) + +-- 4. Strings (Double and Single quoted) +local sq_str = lexer.range("'") +local dq_str = lexer.range('"') +lex:add_rule('string', token(lexer.STRING, sq_str + dq_str)) + +-- 5. Comments (Example: # style comments) +lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#'))) + +-- 6. Numbers +lex:add_rule('number', token(lexer.NUMBER, lexer.number)) + +-- 7. Operators +lex:add_rule('operator', token(lexer.OPERATOR, S('+-*/%^=<>,.{}[]()'))) + +return lex diff --git a/env/.config/vis/plugins.lua b/env/.config/vis/plugins.lua index 015a45c..2a0844b 100644 --- a/env/.config/vis/plugins.lua +++ b/env/.config/vis/plugins.lua @@ -1,20 +1,31 @@ -local _,autoclose = pcall(require,'plugins/vis-autoclose') +pcall(require,'plugins/vis-autoclose') -local cok,colorizer = pcall(require,'plugins/vis-colorizer') -if cok then +local color_ok,colorizer = pcall(require,'plugins/vis-colorizer') +if color_ok then colorizer.three = false colorizer.six = true end -local _,completefilename = pcall(require,'plugins/complete-filename') +pcall(require,'plugins/complete-filename') -local _,chain = pcall(require,'plugins/vis-chain') +pcall(require,'plugins/vis-chain') -local _,lsp = pcall(require,'plugins/vis-lspc') +local lsp_ok,lsp = pcall(require,'plugins/vis-lspc') +if lsp_ok then + lsp.ls_map.c.cmd = "clangd --fallback-style=webkit" + lsp.ls_map.cpp.cmd = "clangd --fallback-style=webkit" + lsp.ls_map.ansi_c.cmd = "clangd --fallback-style=webkit" + + lsp.ls_map.greyscript = { + name = 'greyscript', + cmd = '/bin/greybel-languageserver --stdio', + formatting_options = {tabSize = 4, insertSpaces = true}, + } +end -- https://git.symlinx.net/vis-modal/ -local Vok,modal = pcall(require,'plugins/vis-modal') -if Vok then +local modal_ok,modal = pcall(require,'plugins/vis-modal') +if modal_ok then modal.MODES = { [vis.modes.NORMAL] = ' NORMAL ', [vis.modes.INSERT] = ' INSERT ', diff --git a/env/.config/vis/visrc.lua b/env/.config/vis/visrc.lua index f518a2d..b11f0cb 100644 --- a/env/.config/vis/visrc.lua +++ b/env/.config/vis/visrc.lua @@ -27,3 +27,4 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) end, "") end) +vis.ftdetect.filetypes["greyscript"] = { ext = { "%.src$" } } |
