diff options
| author | Mike Vink <59492084+ivi-vink@users.noreply.github.com> | 2025-01-31 19:25:30 +0000 |
|---|---|---|
| committer | Mike Vink <59492084+ivi-vink@users.noreply.github.com> | 2025-01-31 19:25:30 +0000 |
| commit | 532068f52a245a4bdd65e0135371d0e956e515a7 (patch) | |
| tree | 69fef40679e61e540e99507b1b7a75459edbb3b5 | |
| parent | a5851e9b6de58305436a9aaf5c0f66fcb54232b8 (diff) | |
update vis config
| -rw-r--r-- | mut/vis/themes/gruvbox.lua | 129 | ||||
| -rw-r--r-- | mut/vis/themes/lemonsoda.lua | 144 | ||||
| -rw-r--r-- | mut/vis/themes/peaksea.lua | 114 | ||||
| -rw-r--r-- | mut/vis/visrc.lua | 85 |
4 files changed, 469 insertions, 3 deletions
diff --git a/mut/vis/themes/gruvbox.lua b/mut/vis/themes/gruvbox.lua new file mode 100644 index 0000000..a54008a --- /dev/null +++ b/mut/vis/themes/gruvbox.lua @@ -0,0 +1,129 @@ +-- Gruvbox color scheme by Pavel Pertsev (https://github.com/morhetz) +-- For the Vis text editor by Marc Tanner (https://github.com/martanne) + +-- Set to 'dark' or 'light' +local mode = 'dark' +-- Set to 'hard', 'medium', or 'soft' +local contrast = 'medium' + +local gruvbox = { + dark0h = '#1d2021', + dark0 = '#282828', + dark0s = '#32302f', + dark1 = '#3c3836', + dark2 = '#504945', + dark3 = '#665c54', + dark4 = '#7c6f64', + light0h = '$f9f5d7', + light0 = '#fbf1c7', + light0s = '#f2e5bc', + light1 = '#ebdbb2', + light2 = '#d5c4a1', + light3 = '#bdae93', + light4 = '#a89984', + gray = '#928374', + red0 = '#fb4934', + red1 = '#9d0006', + green0 = '#b8bb26', + green1 = '#79740e', + yellow0 = '#fabd2f', + yellow1 = '#b57614', + blue0 = '#83a598', + blue1 = '#076678', + purple0 = '#d3869b', + purple1 = '#8f3f71', + aqua0 = '#8ec07c', + aqua1 = '#427b58', + orange0 = '#fe8019', + orange1 = '#af3a03', +} + +local colors = {} + +if mode == 'dark' then + if contrast == 'hard' then + colors.bg0 = gruvbox.dark0h + elseif contrast == 'medium' then + colors.bg0 = gruvbox.dark0 + elseif contrast == 'soft' then + colors.bg0 = gruvbox.dark0s + end + colors.bg1 = gruvbox.dark1 + colors.bg2 = gruvbox.dark2 + colors.bg3 = gruvbox.dark3 + colors.bg4 = gruvbox.dark4 + colors.fg0 = gruvbox.light0 + colors.fg1 = gruvbox.light1 + colors.fg2 = gruvbox.light2 + colors.fg3 = gruvbox.light3 + colors.fg4 = gruvbox.light4 + colors.gray = gruvbox.gray + colors.red = gruvbox.red0 + colors.green = gruvbox.green0 + colors.yellow = gruvbox.yellow0 + colors.blue = gruvbox.blue0 + colors.purple = gruvbox.purple0 + colors.aqua = gruvbox.aqua0 + colors.orange = gruvbox.orange0 +elseif mode == 'light' then + if contrast == 'hard' then + colors.bg0 = gruvbox.light0h + elseif contrast == 'medium' then + colors.bg0 = gruvbox.light0 + elseif contrast == 'soft' then + colors.bg0 = gruvbox.light0s + end + colors.bg1 = gruvbox.light1 + colors.bg2 = gruvbox.light2 + colors.bg3 = gruvbox.light3 + colors.bg4 = gruvbox.light4 + colors.fg0 = gruvbox.dark0 + colors.fg1 = gruvbox.dark1 + colors.fg2 = gruvbox.dark2 + colors.fg3 = gruvbox.dark3 + colors.fg4 = gruvbox.dark4 + colors.gray = gruvbox.gray + colors.red = gruvbox.red1 + colors.green = gruvbox.green1 + colors.yellow = gruvbox.yellow1 + colors.blue = gruvbox.blue1 + colors.purple = gruvbox.purple1 + colors.aqua = gruvbox.aqua1 + colors.orange = gruvbox.orange1 +end + +-- To use your terminal's default background (e.g. for transparency), set the value below to 'back:default,fore:'..colors.fg1 +vis.lexers.STYLE_DEFAULT = 'back:'..colors.bg0..',fore:'..colors.fg1 +vis.lexers.STYLE_NOTHING = '' +vis.lexers.STYLE_CLASS = 'fore:'..colors.yellow +vis.lexers.STYLE_COMMENT = 'fore:'..colors.gray..',italics' +vis.lexers.STYLE_CONSTANT = 'fore:'..colors.purple +vis.lexers.STYLE_DEFINITION = 'fore:'..colors.yellow +vis.lexers.STYLE_ERROR = 'fore:'..colors.red..',back:'..colors.bg0..',reverse' +vis.lexers.STYLE_FUNCTION = 'fore:'..colors.green..',bold' +vis.lexers.STYLE_KEYWORD = 'fore:'..colors.red +vis.lexers.STYLE_LABEL = 'fore:'..colors.red +vis.lexers.STYLE_NUMBER = 'fore:'..colors.purple +vis.lexers.STYLE_OPERATOR = vis.lexers.STYLE_DEFAULT +vis.lexers.STYLE_REGEX = 'fore:'..colors.aqua +vis.lexers.STYLE_STRING = 'fore:'..colors.green +vis.lexers.STYLE_PREPROCESSOR = 'fore:'..colors.aqua +vis.lexers.STYLE_TAG = 'fore:'..colors.blue +vis.lexers.STYLE_TYPE = 'fore:'..colors.yellow +vis.lexers.STYLE_VARIABLE = 'fore:'..colors.blue +vis.lexers.STYLE_WHITESPACE = '' +vis.lexers.STYLE_EMBEDDED = 'fore:'..colors.orange +vis.lexers.STYLE_IDENTIFIER = 'fore:'..colors.blue + +vis.lexers.STYLE_LINENUMBER = 'fore:'..colors.bg4 +vis.lexers.STYLE_LINENUMBER_CURSOR = 'fore:'..colors.yellow..',back:'..colors.bg1 +vis.lexers.STYLE_CURSOR = 'reverse' +vis.lexers.STYLE_CURSOR_PRIMARY = vis.lexers.STYLE_CURSOR..',fore:'..colors.yellow +vis.lexers.STYLE_CURSOR_LINE = 'back:'..colors.bg1 +vis.lexers.STYLE_COLOR_COLUMN = 'reverse' +vis.lexers.STYLE_SELECTION = 'back:'..colors.bg3..',reverse' +vis.lexers.STYLE_STATUS = 'fore:'..colors.bg1..',back:'..colors.fg4..',reverse' +vis.lexers.STYLE_STATUS_FOCUSED = 'fore:'..colors.bg2..',back:'..colors.fg1..',reverse' +vis.lexers.STYLE_SEPARATOR = 'fore:'..colors.bg3 +vis.lexers.STYLE_INFO = 'fore:'..colors.yellow..',bold' +vis.lexers.STYLE_EOF = vis.lexers.STYLE_LINENUMBER diff --git a/mut/vis/themes/lemonsoda.lua b/mut/vis/themes/lemonsoda.lua new file mode 100644 index 0000000..2034e7d --- /dev/null +++ b/mut/vis/themes/lemonsoda.lua @@ -0,0 +1,144 @@ +-- lemonsoda.lua + +-- Copyright (C) 2024 + +-- Author: scaramacai +-- ------------------------------------------------------------------------------ +-- This software is available under 2 licenses -- choose whichever you prefer. +-- ------------------------------------------------------------------------------ +-- ALTERNATIVE A - Public Domain (www.unlicense.org) +-- This is free and unencumbered software released into the public domain. +-- Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +-- software, either in source code form or as a compiled binary, for any purpose, +-- commercial or non-commercial, and by any means. +-- In jurisdictions that recognize copyright laws, the author or authors of this +-- software dedicate any and all copyright interest in the software to the public +-- domain. We make this dedication for the benefit of the public at large and to +-- the detriment of our heirs and successors. We intend this dedication to be an +-- overt act of relinquishment in perpetuity of all present and future rights to +-- this software under copyright law. +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +-- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +-- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-- ------------------------------------------------------------------------------ +-- ALTERNATIVE B - MIT License +-- Copyright (c) 2024 scaramacai +-- Permission is hereby granted, free of charge, to any person obtaining a copy of +-- this software and associated documentation files (the "Software"), to deal in +-- the Software without restriction, including without limitation the rights to +-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +-- of the Software, and to permit persons to whom the Software is furnished to do +-- so, subject to the following conditions: +-- The above copyright notice and this permission notice shall be included in all +-- copies or substantial portions of the Software. +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-- SOFTWARE. +-- ------------------------------------------------------------------------------ + + + + + +local lexers = vis.lexers + +local colors = { + ['fg1'] = '#d0d0d0', + ['fg2'] = '#bfbfbf', + ['fg3'] = '#afafaf', + ['fg4'] = '#9e9e9e', + ['fg6'] = '#dbdbdb', + ['bg1'] = '#2e3440', + ['bg2'] = '#323232', + ['bg3'] = '#444444', + ['bg4'] = '#565656', + ['builtin'] = '#ffb4b0', + ['keyword'] = '#ffd000', + ['const'] = '#d1d900', + ['comment'] = '#7b7b3d', + ['func'] = '#8199ff', + ['str'] = '#db94ff', + ['fg_type'] = '#75d27c', + ['var'] = '#4ebae0', + ['selection']= '#3e4450', + ['warning'] = '#2365ff', + ['warning2'] = '#0061e6', + ['back_ln'] = '#555555', + ['fore_ln'] = '#f8f8f8', + ['headers'] = '#225577', + ['prep'] = '#abab9d', + ['type2'] = '#f66151', +} + +lexers.STYLE_DEFAULT = 'fore:'..colors.fg1..','..'back:'..colors.bg1 +lexers.STYLE_NOTHING = '' +lexers.STYLE_CLASS = 'fore:'..colors.func..','..'bold' +lexers.STYLE_COMMENT = 'fore:'..colors.comment..','..'italics' +lexers.STYLE_CONSTANT = 'fore:'..colors.const +lexers.STYLE_CONSTANT_BUILTIN = 'fore:'..colors.const..','..'bold' +lexers.STYLE_ERROR = 'fore:'..colors.warning..','..'italics' +lexers.STYLE_FUNCTION = 'fore:'..colors.func +lexers.STYLE_FUNCTION_BUILTIN = 'fore:'..colors.func..','..'bold' +lexers.STYLE_KEYWORD = 'fore:'..colors.keyword +lexers.STYLE_LABEL = 'fore:'..colors.warning +lexers.STYLE_NUMBER = 'fore:'..colors.const +lexers.STYLE_OPERATOR = 'fore:'..colors.fg2 +lexers.STYLE_REGEX = 'fore:'..colors.str +lexers.STYLE_STRING = 'fore:'..colors.str +lexers.STYLE_PREPROCESSOR = 'fore:'..colors.prep +lexers.STYLE_TAG = 'fore:'..colors.fg3 +lexers.STYLE_TYPE = 'fore:'..colors.fg_type +lexers.STYLE_VARIABLE = 'fore:'..colors.warning +lexers.STYLE_VARIABLE_BUILTIN = 'fore:'..colors.warning..',bold' +lexers.STYLE_WHITESPACE = '' +lexers.STYLE_EMBEDDED = 'fore:'..colors.builtin..','..'back:'..colors.bg2 +lexers.STYLE_IDENTIFIER = 'fore:'..colors.var +lexers.STYLE_BRACELIGHT = 'fore:'..colors.func,'back:'..colors.bg2..','..'bold' +lexers.STYLE_BRACEBAD = 'fore:'..colors.warning,'back:'..colors.bg3..','..'bold' +-- view.STYLE_CONTROLCHAR = +lexers.STYLE_INDENTGUIDE = 'fore:'..colors.comment +lexers.STYLE_CALLTIP = 'fore:'..colors.fg1..','..'back:'..colors.bg2 +lexers.STYLE_FOLDDISPLAYTEXT = 'fore:'..colors.bg2 + +-- Tgag styles. +-- lexers.STYLE_ANNOTATION = 'fore:'..colors.magenta +lexers.STYLE_ATTRIBUTE = 'fore:'..colors.fg3 +lexers.STYLE_BOLD = 'bold' +lexers.STYLE_CODE = '' +-- lexers.STYLE_FUNCTION_METHOD = +lexers.STYLE_HEADING = 'fore:'..colors.fg1 .. ',back:' .. colors.headers +lexers.STYLE_ITALIC = 'italics' +-- lexers.STYLE_LINK = +-- lexers.STYLE_LIST = +lexers.STYLE_REFERENCE = 'fore:'..colors.var +-- lexers.STYLE_UNDERLINE = 'fore:'..colors.warning +lexers.STYLE_LINENUMBER = 'fore:'..colors.fg1..','..'back:'..colors.bg2 +lexers.STYLE_LINENUMBER_CURSOR = 'fore:'..colors.fore_ln..','..'back:'..colors.back_ln + +lexers.STYLE_CURSOR = 'fore:'..colors.bg1..',back:'..colors.fg4 +lexers.STYLE_CURSOR_PRIMARY = 'fore:'..colors.bg1..',back:'..colors.fg1 +lexers.STYLE_CURSOR_LINE = 'back:'..colors.bg4 +lexers.STYLE_COLOR_COLUMN = 'back:'..colors.bg4 +lexers.STYLE_SELECTION = 'back:'..colors.selection +--lexers.STYLE_STATUS = 'reverse' +lexers.STYLE_STATUS = 'fore:'..colors.fg2..',back:'..colors.bg3 +--lexers.STYLE_STATUS_FOCUSED = 'reverse,bold' +lexers.STYLE_STATUS_FOCUSED = 'fore:'..colors.fg2..',back:'..colors.bg3..',bold' +lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT + + +-- Markdown +lexers.STYLE_HR = '' +for i = 1,6 do lexers['STYLE_HEADING_H'..i] = lexers.STYLE_HEADING end +lexers.STYLE_BOLD = 'bold' +lexers.STYLE_ITALIC = 'italics' +lexers.STYLE_LIST = lexers.STYLE_KEYWORD +lexers.STYLE_LINK = lexers.STYLE_KEYWORD +lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD diff --git a/mut/vis/themes/peaksea.lua b/mut/vis/themes/peaksea.lua new file mode 100644 index 0000000..a23be9d --- /dev/null +++ b/mut/vis/themes/peaksea.lua @@ -0,0 +1,114 @@ +local lexers = vis.lexers +local peaksea={ + bgdark='#1c1c1c',--black + bglight='#e4e4e4',--white + annotationdark='#5fff87',--green + annotationlight='#00875f',--tuerkis + functiondark='#e8a0e8',--violett + functionlight='#af5faf',--pink + normalfontdark='#d0d0d0',--dark grey + normalfontlight='#000000',--grey + stringdark='#afd7ff',--light grey + stringlight='#005f5f',--cyan + numberdark='#e0c060',--dark yellow + numberlight='#875f00',--dark yellow little brown + commentdark='#d0d090',--dark golden dirty + commentlight='#5f5f00',--light golden dirty + bgerrordark='#aa0000',--red + bgerrorlight='#80c0e0',--red + fglinenumberdark='#b0b0b0',--white + fglinenumberlight='#6c6c6c',--grey + constantdark='#80c0e0',--cyan + constantlight='#000000', + identifierdark='#d0d0d0',--white + identifierlight='#000000', + bgstatusdark='#d7ff00',--dark yellow + bgstatuslight='#000000', + bgcursordark='#262626', + bgcursorlight='#add8e6',--cyan + fgoperatorlight='#005faf',--blue + fgdark='#d0d0d0', + fglight='#1b1b1b', + embeddedlight='#875f00', + fgstatusbarlight='#5fffaf' +} +if background==nil +then + background="dark" +end + +if background=="dark" +then + lexers.STYLE_DEFAULT='fore:'..peaksea.fgdark..', back:'..peaksea.bgdark + lexers.STYLE_CLASS='fore:'..peaksea.normalfontdark + lexers.STYLE_COMMENT='fore:'..peaksea.commentdark + lexers.STYLE_CONSTANT='fore:'..peaksea.constantdark + lexers.STYLE_DEFINITION='fore:'..peaksea.bgerrordark--TODO + lexers.STYLE_ERROR='fore:'..peaksea.commentdark..',back:'..peaksea.bgerrordark + lexers.STYLE_FUNCTION='fore:'..peaksea.functiondark + lexers.STYLE_KEYWORD = 'fore:'..peaksea.stringdark--if other logical operators + lexers.STYLE_LABEL = 'fore:'..peaksea.functiondark + lexers.STYLE_NUMBER = 'fore:'..peaksea.numberdark + vis.lexers.STYLE_OPERATOR = vis.lexers.STYLE_DEFAULT--for the brackets + lexers.STYLE_REGEX = 'fore:'..peaksea.bgerrordark + lexers.STYLE_STRING = 'fore:'..peaksea.stringdark + lexers.STYLE_PREPROCESSOR = 'fore:'..peaksea.annotationdark--annotations + lexers.STYLE_TAG = 'fore:'..peaksea.bgerrordark + lexers.STYLE_TYPE = 'fore:'..peaksea.functiondark + lexers.STYLE_VARIABLE = 'fore:'..peaksea.functiondark + lexers.STYLE_WHITESPACE = '' + lexers.STYLE_EMBEDDED = 'fore:'..peaksea.commentdark + lexers.STYLE_IDENTIFIER = 'fore:'..peaksea.identifierdark --imports and co + + lexers.STYLE_LINENUMBER='fore:'..peaksea.fglinenumberdark..',back:'..peaksea.bgdark + lexers.STYLE_LINENUMBER_CURSOR = 'fore:'..peaksea.fglinenumberdark..',back:'..peaksea.bgdark + lexers.STYLE_CURSOR='fore:'..peaksea.bgdark..',back:'..peaksea.annotationdark + + lexers.STYLE_CURSOR_PRIMARY = 'fore:'..peaksea.bgdark..',back:'..peaksea.stringdark--cursor in normal mode + lexers.STYLE_CURSOR_LINE = 'back:'..peaksea.bgcursordark + + lexers.STYLE_COLOR_COLUMN = 'back:'..peaksea.normalfontdark + lexers.STYLE_SELECTION = 'fore:'..peaksea.bgdark..',back:'..peaksea.stringdark + lexers.STYLE_STATUS = 'fore:'..peaksea.bgdark..',back:'..peaksea.bgstatusdark + lexers.STYLE_STATUS_FOCUSED = 'fore:'..peaksea.bgdark..',back:'..peaksea.bgstatusdark + lexers.STYLE_SEPARATOR = 'back:'..peaksea.bgstatusdark + lexers.STYLE_INFO = 'fore:'..peaksea.bgerrordark + lexers.STYLE_EOF = 'fore:'..peaksea.fglinenumberdark..',back:'..peaksea.bgdark +elseif background=="light" +then + lexers.STYLE_DEFAULT='fore:'..peaksea.fglight..',back:'..peaksea.bglight + lexers.STYLE_CLASS='fore:'..peaksea.normalfontlight + lexers.STYLE_COMMENT='fore:'..peaksea.commentlight + lexers.STYLE_CONSTANT='fore:'..peaksea.constantlight + lexers.STYLE_DEFINITION='fore:'..peaksea.bgerrorlight--TODO + lexers.STYLE_ERROR='fore:'..peaksea.commentlight..',back:'..peaksea.bgerrorlight + lexers.STYLE_FUNCTION='fore:'..peaksea.functionlight + lexers.STYLE_KEYWORD = 'fore:'..peaksea.fgoperatorlight..',bold'--if other logical operators + lexers.STYLE_LABEL = 'fore:'..peaksea.functionlight + lexers.STYLE_NUMBER = 'fore:'..peaksea.numberlight + vis.lexers.STYLE_OPERATOR = 'fore:'..peaksea.fgoperatorlight + lexers.STYLE_REGEX = 'fore:'..peaksea.bgerrorlight + lexers.STYLE_STRING = 'fore:'..peaksea.stringlight + lexers.STYLE_PREPROCESSOR = 'fore:'..peaksea.annotationlight--annotations + lexers.STYLE_TAG = 'fore:'..peaksea.bgerrorlight + lexers.STYLE_TYPE = 'fore:'..peaksea.functionlight + lexers.STYLE_VARIABLE = 'fore:'..peaksea.functionlight + lexers.STYLE_WHITESPACE = '' + lexers.STYLE_EMBEDDED = 'fore:'..peaksea.embeddedlight + lexers.STYLE_IDENTIFIER = 'fore:'..peaksea.identifierlight --imports and co + + lexers.STYLE_LINENUMBER='fore:'..peaksea.fglinenumberlight..',back:'..peaksea.bglight + lexers.STYLE_LINENUMBER_CURSOR = 'fore:'..peaksea.fglinenumberlight..',back:'..peaksea.bglight + lexers.STYLE_CURSOR='fore:'..peaksea.bglight..',back:'..peaksea.bgdark--bgcursorlight + + lexers.STYLE_CURSOR_PRIMARY = 'fore:'..peaksea.bgdark..',back:'..peaksea.bgcursorlight--cursor in normal mode + lexers.STYLE_CURSOR_LINE = 'back:'..peaksea.bglight + + lexers.STYLE_COLOR_COLUMN = 'back:'..peaksea.normalfontlight + lexers.STYLE_SELECTION = 'fore:'..peaksea.bglight..',back:'..peaksea.bgcursorlight..',bold' + lexers.STYLE_STATUS = 'fore:'..peaksea.bglight..',back:'..peaksea.bgstatuslight + lexers.STYLE_STATUS_FOCUSED = 'fore:'..peaksea.fgstatusbarlight..',back:'..peaksea.bgstatuslight + lexers.STYLE_SEPARATOR = 'back:'..peaksea.bgstatuslight + lexers.STYLE_INFO = 'fore:'..peaksea.bgerrorlight + lexers.STYLE_EOF = 'fore:'..peaksea.fglinenumberlight..',back:'..peaksea.bglight +end diff --git a/mut/vis/visrc.lua b/mut/vis/visrc.lua index 35df8e8..898df9c 100644 --- a/mut/vis/visrc.lua +++ b/mut/vis/visrc.lua @@ -1,19 +1,98 @@ -- load standard vis module, providing parts of the Lua API require('vis') require('vis-editorconfig') -require('vis-quickfix') - +local quickfix = require('vis-quickfix') local format = require('vis-format') +local m = vis.modes + +quickfix.grepprg = "rg --hidden --no-ignore-vcs --vimgrep" + +vis.ftdetect.filetypes.terraform = { + ext = { "%.tf$" }, +} for k, _ in pairs(format.formatters) do format.formatters[k] = nil end format.formatters.python = format.stdio_formatter("ruff format -", {on_save=true}) - +format.formatters.terraform = format.stdio_formatter("terraform fmt -", {on_save=true}) vis.events.subscribe(vis.events.INIT, function() vis:command"set shell '/usr/bin/bash'" vis:command"set edconfhooks on" + vis:command"set theme lemonsoda" + + vis:map(m.INSERT, '<C-r>"', '<C-r>+') + vis:map(m.NORMAL, 'y', '<vis-register>+<vis-operator-yank>') + vis:map(m.VISUAL, 'y', '<vis-register>+<vis-operator-yank>') + vis:map(m.VISUAL_LINE, 'y', '<vis-register>+<vis-operator-yank>') + vis:map(m.NORMAL, 'd', '<vis-register>+<vis-operator-delete>') + vis:map(m.VISUAL, 'd', '<vis-register>+<vis-operator-delete>') + vis:map(m.VISUAL_LINE, 'd', '<vis-register>+<vis-operator-delete>') + vis:map(m.NORMAL, 'p', '<vis-register>+<vis-put-after>') + vis:map(m.VISUAL, 'p', '<vis-register>+<vis-put-after>') + vis:map(m.VISUAL_LINE, 'p', '<vis-register>+<vis-put-after>') + vis:map(m.NORMAL, 'P', '<vis-register>+<vis-put-before>') + vis:map(m.VISUAL, 'P', '<vis-register>+<vis-put-before>') + vis:map(m.VISUAL_LINE, 'P', '<vis-register>+<vis-put-before>') end) +local files = {} vis.events.subscribe(vis.events.WIN_OPEN, function(win) + vis:command"set cul on" + local radix = files[vis.win.file.path] + for p, i in pairs(files) do + if (radix == nil) or (radix >= i) then + files[p] = i + 1 + end + end + if vis.win.file.path then + files[vis.win.file.path] = 0 + end +end) + +vis:map(m.NORMAL, "<M-x>b", function() + local keys = {} + for k in pairs(files) do if k ~= vis.win.file.path then table.insert(keys, k) end end + if next(keys) == nil then + return true + end + table.sort(keys, function(a, b) return files[a] < files[b] end) + local code, result, err = vis:pipe(table.concat(keys, "\n"), "vis-menu -l 3") + if result then + vis:command("e " .. result) + end + return true; +end) + +vis:map(m.NORMAL, "<M-x>~", function() + vis:command("cd " .. vis.win.file.path:match("(.+)/[^/]+$")) + return true; +end) +vis:map(m.NORMAL, "<M-x>f", function() + local code, result, err = vis:pipe("", "vis-open .") + if result then + + if not os.execute("cd " .. result) then + vis:command("e " .. result) + else + vis:command("cd " .. result) + local code, result, err = vis:pipe("", "lf --print-selection") + if not result then return true end + local lines = {} + for line in result:gmatch("[^\n]+") do table.insert(lines, line) end + if lines[1] then + vis:command("e " .. lines[1]) + end + end + return true; + end + return true; +end) +vis:map(m.NORMAL, "<M-x>-", function() + local code, result, err = vis:pipe("", "lf --print-selection") + vis:command("cd " .. err) + if result then + vis:command("e " .. result) + end + return true; end) |
