summaryrefslogtreecommitdiff
path: root/mut/vis
diff options
context:
space:
mode:
authorMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-02-08 15:43:40 +0000
committerMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-02-08 15:43:40 +0000
commitf05fbfb4451959850315218bb031c5fe4c6dbb14 (patch)
treee0f8844c3b44c00e44336474381da3f816645924 /mut/vis
parent6d4ccf06355a0da9cb275413fbd4b7aa2a8b7087 (diff)
updates
Diffstat (limited to 'mut/vis')
-rw-r--r--mut/vis/themes/base16-twilight.lua63
-rw-r--r--mut/vis/visrc.lua52
2 files changed, 94 insertions, 21 deletions
diff --git a/mut/vis/themes/base16-twilight.lua b/mut/vis/themes/base16-twilight.lua
new file mode 100644
index 0000000..62d1ea6
--- /dev/null
+++ b/mut/vis/themes/base16-twilight.lua
@@ -0,0 +1,63 @@
+-- base16-vis (https://github.com/pshevtsov/base16-vis)
+-- by Petr Shevtsov
+-- Twilight scheme by David Hart (https://github.com/hartbit)
+
+local lexers = vis.lexers
+
+local colors = {
+ ['base00'] = '#1e1e1e',
+ ['base01'] = '#323537',
+ ['base02'] = '#464b50',
+ ['base03'] = '#5f5a60',
+ ['base04'] = '#838184',
+ ['base05'] = '#a7a7a7',
+ ['base06'] = '#c3c3c3',
+ ['base07'] = '#ffffff',
+ ['base08'] = '#cf6a4c',
+ ['base09'] = '#cda869',
+ ['base0A'] = '#f9ee98',
+ ['base0B'] = '#8f9d6a',
+ ['base0C'] = '#afc4db',
+ ['base0D'] = '#7587a6',
+ ['base0E'] = '#9b859d',
+ ['base0F'] = '#9b703f',
+}
+
+lexers.colors = colors
+
+local fg = ',fore:'..colors.base05..','
+local bg = ',back:'..colors.base00..','
+
+lexers.STYLE_DEFAULT = bg..fg
+lexers.STYLE_NOTHING = bg
+lexers.STYLE_CLASS = 'fore:'..colors.base0A
+lexers.STYLE_COMMENT = 'fore:'..colors.base03..',italics'
+lexers.STYLE_CONSTANT = 'fore:'..colors.base09
+lexers.STYLE_DEFINITION = 'fore:'..colors.base0E
+lexers.STYLE_ERROR = 'fore:'..colors.base08..',italics'
+lexers.STYLE_FUNCTION = 'fore:'..colors.base0D
+lexers.STYLE_KEYWORD = 'fore:'..colors.base0E
+lexers.STYLE_LABEL = 'fore:'..colors.base0A
+lexers.STYLE_NUMBER = 'fore:'..colors.base09
+lexers.STYLE_OPERATOR = 'fore:'..colors.base05
+lexers.STYLE_REGEX = 'fore:'..colors.base0C
+lexers.STYLE_STRING = 'fore:'..colors.base0B
+lexers.STYLE_PREPROCESSOR = 'fore:'..colors.base0A
+lexers.STYLE_TAG = 'fore:'..colors.base0A
+lexers.STYLE_TYPE = 'fore:'..colors.base0A
+lexers.STYLE_VARIABLE = 'fore:'..colors.base0D
+lexers.STYLE_WHITESPACE = 'fore:'..colors.base02
+lexers.STYLE_EMBEDDED = 'fore:'..colors.base0F
+lexers.STYLE_IDENTIFIER = 'fore:'..colors.base08
+
+lexers.STYLE_LINENUMBER = 'fore:'..colors.base02..',back:'..colors.base00
+lexers.STYLE_CURSOR = 'fore:'..colors.base00..',back:'..colors.base05
+lexers.STYLE_CURSOR_PRIMARY = 'fore:'..colors.base00..',back:'..colors.base05
+lexers.STYLE_CURSOR_LINE = 'back:'..colors.base01
+lexers.STYLE_COLOR_COLUMN = 'back:'..colors.base01
+lexers.STYLE_SELECTION = 'back:'..colors.base02
+lexers.STYLE_STATUS = 'fore:'..colors.base04..',back:'..colors.base01
+lexers.STYLE_STATUS_FOCUSED = 'fore:'..colors.base09..',back:'..colors.base01
+lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
+lexers.STYLE_INFO = 'fore:default,back:default,bold'
+lexers.STYLE_EOF = ''
diff --git a/mut/vis/visrc.lua b/mut/vis/visrc.lua
index 898df9c..4f87b50 100644
--- a/mut/vis/visrc.lua
+++ b/mut/vis/visrc.lua
@@ -19,6 +19,7 @@ format.formatters.terraform = format.stdio_formatter("terraform fmt -", {on_save
vis.events.subscribe(vis.events.INIT, function()
vis:command"set shell '/usr/bin/bash'"
vis:command"set edconfhooks on"
+ vis:command"set change256colors off"
vis:command"set theme lemonsoda"
vis:map(m.INSERT, '<C-r>"', '<C-r>+')
@@ -39,6 +40,9 @@ end)
local files = {}
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
vis:command"set cul on"
+ vis:command"set number"
+ vis:command"set relativenumber"
+ vis:command"set change256colors off"
local radix = files[vis.win.file.path]
for p, i in pairs(files) do
if (radix == nil) or (radix >= i) then
@@ -50,7 +54,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
end
end)
-vis:map(m.NORMAL, "<M-x>b", function()
+vis:map(m.NORMAL, "<C-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
@@ -64,35 +68,41 @@ vis:map(m.NORMAL, "<M-x>b", function()
return true;
end)
-vis:map(m.NORMAL, "<M-x>~", function()
- vis:command("cd " .. vis.win.file.path:match("(.+)/[^/]+$"))
+local parent = function(filename)
+ if filename ~= nil then
+ return filename:match("(.+)/[^/]+$")
+ end
+ return nil
+end
+
+local lfcd = function(cd_or_select_path)
+ local code, result, err = vis:pipe("", "lf --print-selection " .. cd_or_select_path)
+ vis:command("cd " .. err)
+ if result then
+ vis:command("e " .. result)
+ end
+ return true;
+end
+
+vis:map(m.NORMAL, "<C-x>~", function()
+ vis:command("cd " .. (parent(vis.win.file.path) or "."))
return true;
end)
-vis:map(m.NORMAL, "<M-x>f", function()
- local code, result, err = vis:pipe("", "vis-open .")
+vis:map(m.NORMAL, "<C-x><C-f>", function()
+ local code, result, err = vis:pipe("", "vis-open " .. (parent(vis.win.file.path) or "."))
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
+ return lfcd(result)
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;
+vis:map(m.NORMAL, "<C-x>-", function()
+ return lfcd(parent(vis.win.file.path) or "")
+end)
+vis:map(m.NORMAL, "<C-x>_", function()
+ return lfcd(".")
end)