Clean up of old configs.

This commit is contained in:
2026-10-14 07:42:20 +02:00
parent 7d9fc403b0
commit ed196212ed
12 changed files with 0 additions and 1335 deletions
-68
View File
@@ -1,68 +0,0 @@
-- Runs ./build.sh from vis's cwd (project root), logs the output for the
-- error picker (pickers.errors), and returns to vis on Enter/Esc.
local M = {}
-- last build's output; pickers.errors() reads it
M.log = '/tmp/vis-build.log'
-- single-quote a string for the shell
local function q(s) return "'" .. s:gsub("'", "'\\''") .. "'" end
-- write a raw escape sequence straight to the terminal
local function tty(s)
local t = io.open('/dev/tty', 'w')
if t then t:write(s) t:close() end
end
local function exists(path)
local f = io.open(path, 'r')
if f then f:close() end
return f ~= nil
end
-- args: flags passed through to build.sh, e.g. { 'run' }
function M.run(args)
if not exists('build.sh') then
vis:info('No build.sh in current directory')
return
end
-- save so the build sees your latest changes
local file = vis.win and vis.win.file
if file and file.modified and file.path then vis:command('w') end
local parts = {}
for _, a in ipairs(args or {}) do parts[#parts + 1] = q(a) end
local argstr = table.concat(parts, ' ')
local script = table.concat({
'saved=$(stty -g); stty sane',
-- script runs the build on a pty (colors stay on) and logs it to M.log
'script -qefc ' .. q('bash ./build.sh ' .. argstr) .. ' ' .. q(M.log),
'st=$?',
[[printf '\n[exit %s] enter/esc: back to vis ' "$st"]],
[[while IFS= read -rsn1 k; do [ -z "$k" ] || [ "$k" = $'\e' ] && break; done]],
'stty "$saved"',
}, '\n')
-- leave the alt screen and clear it, so each run starts fresh and the
-- output lands in normal scrollback; run; come back to vis
tty('\27[?1049l\27[H\27[2J')
os.execute('bash -c ' .. q(script) .. ' </dev/tty >/dev/tty 2>&1')
tty('\27[?1049h')
vis:redraw()
end
-- ---------------------------------------------------------------------------
-- events
-- ---------------------------------------------------------------------------
-- re-index tags in the background after saving an .odin file
-- (build.sh -t re-scans src and merges it with the cached stdlib tags)
vis.events.subscribe(vis.events.FILE_SAVE_POST, function(file, path) -- luacheck: no unused args
if path and path:match('%.odin$') and exists('build.sh') then
os.execute('bash ./build.sh -t </dev/null >/dev/null 2>&1 &')
end
end)
return M
-130
View File
@@ -1,130 +0,0 @@
-- Copyright 2026 Artur Ugnivenko. See LICENSE.
-- Odin LPeg lexer.
-- References:
-- https://odin-lang.org/spec/grammar/
-- https://pkg.odin-lang.org/base/builtin/
local lexer = lexer
local P, S, R = lpeg.P, lpeg.S, lpeg.R
local lex = lexer.new(...)
local ws = S(' \t')^0
local word_end = -(lexer.alnum + '_')
-- Keywords.
lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD)))
-- Definitions: `name :: proc` and `Name :: struct / enum / union / distinct ...`.
local proc_def = lex:tag(lexer.FUNCTION, lexer.word) *
#(ws * '::' * ws * ('#' * lexer.word * ws)^0 * 'proc' * word_end)
local type_def = lex:tag(lexer.TYPE, lexer.word) *
#(ws * '::' * ws *
(P('struct') + 'enum' + 'union' + 'bit_set' + 'bit_field' + 'distinct') * word_end)
lex:add_rule('definition', proc_def + type_def)
-- Types.
lex:add_rule('type', lex:tag(lexer.TYPE, lex:word_match(lexer.TYPE)))
-- Polymorphic parameters: $T, $N.
lex:add_rule('poly', lex:tag(lexer.TYPE, '$' * lexer.word))
-- Functions.
local builtin_func = -lpeg.B('.') *
lex:tag(lexer.FUNCTION_BUILTIN, lex:word_match(lexer.FUNCTION_BUILTIN))
local func = lex:tag(lexer.FUNCTION, lexer.word)
lex:add_rule('function', (builtin_func + func) * #P('('))
-- Constants.
lex:add_rule('constant', lex:tag(lexer.CONSTANT_BUILTIN, lex:word_match(lexer.CONSTANT_BUILTIN)))
-- Variables.
lex:add_rule('variable',
lex:tag(lexer.VARIABLE_BUILTIN, lex:word_match(lexer.VARIABLE_BUILTIN)))
-- Identifiers.
lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word))
-- Strings. Quoted strings end at the line; raw strings span lines, no escapes.
local sq_str = lexer.range("'", true)
local dq_str = lexer.range('"', true)
local raw_str = lexer.range('`', false, false)
lex:add_rule('string', lex:tag(lexer.STRING, sq_str + dq_str + raw_str))
-- Comments.
local comment = lexer.to_eol(P('//') + '#!')
local block_comment = lexer.range('/*', '*/', false, false, true)
local file_tag = lexer.to_eol('#+')
lex:add_rule('comment', lex:tag(lexer.COMMENT, comment + block_comment + file_tag))
-- Directives.
lex:add_rule('directive', lex:tag(lexer.PREPROCESSOR, '#' * S(' \t')^0 * lexer.word))
-- Attributes.
lex:add_rule('attribute', lex:tag(lexer.PREPROCESSOR, '@' * lexer.word^-1))
-- Numbers: 1_000_000, 1.5e-3, 0xff, 0b1010, 0o17, 0z1a (dozenal), 0h3f80_0000 (hex float), 2i.
local function digits(d) return d * (P('_')^-1 * d)^0 end
local dec = digits(lexer.digit)
local float = (dec * '.' * dec^-1 * -P('.') + '.' * dec) * (S('eE') * S('+-')^-1 * dec)^-1 +
dec * S('eE') * S('+-')^-1 * dec
local int = '0' * (
S('xh') * P('_')^-1 * digits(lexer.xdigit) +
'b' * P('_')^-1 * digits(S('01')) +
'o' * P('_')^-1 * digits(R('07')) +
'z' * P('_')^-1 * digits(R('09') + S('abAB'))) + dec
lex:add_rule('number', lex:tag(lexer.NUMBER, (float + int) * S('ijk')^-1))
-- Operators.
lex:add_rule('operator', lex:tag(lexer.OPERATOR, '..' + S('+-/*%<>!=^&|?~:;,.()[]{}')))
-- Fold points.
lex:add_fold_point(lexer.OPERATOR, '(', ')')
lex:add_fold_point(lexer.OPERATOR, '[', ']')
lex:add_fold_point(lexer.OPERATOR, '{', '}')
lex:add_fold_point(lexer.COMMENT, '/*', '*/')
-- Word lists.
lex:set_word_list(lexer.KEYWORD, {
'asm', 'auto_cast', 'bit_field', 'bit_set', 'break', 'case', 'cast', 'continue', 'defer',
'distinct', 'do', 'dynamic', 'else', 'enum', 'fallthrough', 'for', 'foreign', 'if', 'import',
'in', 'map', 'matrix', 'not_in', 'or_break', 'or_continue', 'or_else', 'or_return', 'package',
'proc', 'return', 'struct', 'switch', 'transmute', 'union', 'using', 'when', 'where'
})
lex:set_word_list(lexer.TYPE, {
'any', 'b8', 'b16', 'b32', 'b64', 'bool', 'byte', 'complex32', 'complex64', 'complex128',
'cstring', 'cstring16', 'f16', 'f16le', 'f16be', 'f32', 'f32le', 'f32be', 'f64', 'f64le', 'f64be',
'i8', 'i16', 'i16le', 'i16be', 'i32', 'i32le', 'i32be', 'i64', 'i64le', 'i64be', 'i128',
'i128le', 'i128be', 'int', 'quaternion64', 'quaternion128', 'quaternion256', 'rawptr', 'rune',
'string', 'string16', 'typeid', 'u8', 'u16', 'u16le', 'u16be', 'u32', 'u32le', 'u32be', 'u64',
'u64le', 'u64be', 'u128', 'u128le', 'u128be', 'uint', 'uintptr'
})
lex:set_word_list(lexer.FUNCTION_BUILTIN, {
-- compiler built-ins
'abs', 'align_of', 'cap', 'clamp', 'complex', 'compress_values', 'conj', 'expand_values', 'imag',
'jmag', 'kmag', 'len', 'max', 'min', 'offset_of', 'offset_of_by_string', 'offset_of_member',
'offset_of_selector', 'quaternion', 'raw_data', 'real', 'size_of', 'soa_unzip', 'soa_zip',
'swizzle', 'type_info_of', 'type_of', 'typeid_of',
-- base:runtime procs exported as @(builtin)
'append', 'assert', 'card', 'clear', 'copy', 'delete', 'delete_key', 'ensure', 'free',
'free_all', 'inject_at', 'make', 'new', 'new_clone', 'ordered_remove', 'panic', 'pop',
'pop_front', 'reserve', 'resize', 'shrink', 'unimplemented', 'unordered_remove', 'unreachable'
})
lex:set_word_list(lexer.CONSTANT_BUILTIN, {
'false', 'true', 'nil', 'ODIN_ARCH', 'ODIN_BUILD_MODE', 'ODIN_COMPILE_TIMESTAMP', 'ODIN_DEBUG',
'ODIN_DEFAULT_TO_NIL_ALLOCATOR', 'ODIN_DEFAULT_TO_PANIC_ALLOCATOR', 'ODIN_DISABLE_ASSERT',
'ODIN_ENDIAN', 'ODIN_ERROR_POS_STYLE', 'ODIN_NO_BOUNDS_CHECK', 'ODIN_NO_CRT',
'ODIN_NO_ENTRY_POINT', 'ODIN_NO_RTTI', 'ODIN_NO_TYPE_ASSERT', 'ODIN_OPTIMIZATION_MODE',
'ODIN_OS', 'ODIN_PLATFORM_SUBTARGET', 'ODIN_ROOT', 'ODIN_TEST', 'ODIN_VENDOR', 'ODIN_VERSION',
'ODIN_WINDOWS_SUBSYSTEM'
})
lex:set_word_list(lexer.VARIABLE_BUILTIN, {
'context', 'runtime'
})
return lex
-285
View File
@@ -1,285 +0,0 @@
-- pickers: fuzzy file finder, live ripgrep, build errors, yazi file manager, gitu.
local M = {}
-- height of the drop-down fzf panel at the top ('100%' = full screen)
M.height = '100%'
-- ---------------------------------------------------------------------------
-- shared constants
-- ---------------------------------------------------------------------------
local BAT = 'bat --theme=custom_zen --color=always --style=numbers'
local PREVIEW_FILE = BAT .. ' --line-range=:500 {}' -- {} = path
local PREVIEW_AT = BAT .. ' --highlight-line {2} {1}' -- {1}=path {2}=line
local KEYS_NAV = 'ctrl-n:down,ctrl-p:up'
local KEYS_PREVIEW = 'ctrl-/:toggle-preview,shift-up:preview-up,shift-down:preview-down'
-- an Odin error line (-error-pos-style:unix): path.odin:line:col: message
local ERROR_PATTERN = '^(.-%.odin):(%d+):(%d+):'
-- ---------------------------------------------------------------------------
-- helpers
-- ---------------------------------------------------------------------------
-- single-quote a string for the shell
local function q(s)
return "'" .. s:gsub("'", "'\\''") .. "'"
end
-- write a raw escape sequence straight to the terminal
local function tty_write(seq)
local tty = io.open('/dev/tty', 'w')
if tty then
tty:write(seq)
tty:close()
end
end
-- hand the terminal back to vis: re-enter the alt screen and repaint
local function restore_screen()
tty_write('\27[?1049h')
vis:redraw()
end
-- fzf command line: common flags + a list of extra options
local function fzf(prompt, opts)
return 'fzf --height=' .. M.height .. ' --layout=reverse --border'
.. ' --prompt ' .. q(prompt) .. ' ' .. table.concat(opts, ' ')
end
-- "--flag 'value'"
local function opt(flag, value)
return flag .. ' ' .. q(value)
end
-- run an fzf pipeline; returns its output lines and exit code
local function run_fzf(cmd)
-- --height mode draws from the cursor down, so start at the top-left
tty_write('\27[H')
local handle = io.popen(cmd)
if not handle then
vis:info('fzf: failed to start')
return nil
end
local lines = {}
for line in handle:lines() do table.insert(lines, line) end
local _, _, code = handle:close()
restore_screen()
return lines, code
end
-- open a path in the current window, unless it's already the current file.
-- returns false if the buffer has unsaved changes and nothing was opened
local function open_path(path)
local win = vis.win
local current = win and win.file and win.file.path
if current and (current == path or current:sub(-#path - 1) == '/' .. path) then
return true
end
if win and win.file and win.file.modified then
vis:info('Buffer has unsaved changes — :w first (or use :e! manually)')
return false
end
vis:command(string.format("e '%s'", path))
return true
end
-- ---------------------------------------------------------------------------
-- files: fuzzy-find a file, or create one from the query
-- enter open in the current window
-- ctrl-v open in a vertical split
-- alt-enter create a file named after the query
-- ctrl-n/p move down/up
-- ---------------------------------------------------------------------------
function M.files()
local cmd = 'fd --type f --hidden --exclude .git | ' .. fzf('files> ', {
'--print-query --expect=alt-enter,ctrl-v', -- output: query, key, choice
opt('--header', 'enter: open · alt-enter: new file · ctrl-v: vsplit'),
opt('--preview', PREVIEW_FILE),
opt('--preview-window', 'down:75%:border-top'),
opt('--bind', KEYS_NAV),
opt('--bind', KEYS_PREVIEW),
})
local out, code = run_fzf(cmd)
if not out or code == 130 then return end -- failed, or Esc / Ctrl-C
local query, key, choice = out[1], out[2], out[3]
local is_new = key == 'alt-enter' or not choice or choice == ''
local path = is_new and query or choice
if not path or path == '' then return end
if key == 'ctrl-v' then
vis:command(string.format("vsplit '%s'", path))
elseif not open_path(path) then
return
end
if is_new then
vis:info('New file: ' .. path .. ' (written to disk on :w)')
end
end
-- ---------------------------------------------------------------------------
-- grep: live ripgrep search across the project, jump to the match
-- M.grep() start empty, results appear as you type
-- M.grep_selection() visual mode: start with the selected text
-- ---------------------------------------------------------------------------
local function grep_with(query)
-- don't run rg on an empty query (it would match every line)
local reload = '[ -n {q} ] && rg --column --line-number --no-heading'
.. ' --color=always --smart-case --hidden --glob "!.git" -- {q} || true'
local opts = {
'--ansi --disabled', -- let rg do the matching, not fzf
'--delimiter :', -- fields: path:line:col:text
opt('--bind', 'change:reload:' .. reload),
opt('--preview', PREVIEW_AT),
opt('--preview-window', 'down:90%:border-top:+{2}/2'),
opt('--bind', KEYS_PREVIEW),
}
if query then
table.insert(opts, opt('--query', query))
table.insert(opts, opt('--bind', 'start:reload:' .. reload))
end
-- empty stdin: results only appear once there is a query
local out = run_fzf(': | ' .. fzf('rg> ', opts))
local choice = out and out[1]
if not choice or choice == '' then return end
choice = choice:gsub('\27%[[%d;]*m', '') -- strip colour codes
local path, line, col = choice:match('^(.-):(%d+):(%d+):')
if not path or not open_path(path) then return end
vis.win.selection:to(tonumber(line), tonumber(col))
end
function M.grep()
grep_with(nil)
end
function M.grep_selection()
local win = vis.win
local text
if win and win.file and win.selection.range then
text = win.file:content(win.selection.range)
end
-- leave visual mode before fzf takes over the screen
vis.mode = vis.modes.NORMAL
-- first line of the selection only; nothing usable -> plain grep
text = text and text:match('^[^\n]*')
if not text or text:match('^%s*$') then
grep_with(nil)
else
grep_with(text)
end
end
-- ---------------------------------------------------------------------------
-- errors: browse the errors from the last build (the log build.lua writes)
-- enter jump to the error
-- ---------------------------------------------------------------------------
function M.errors()
local f = io.open(require('build').log, 'r')
if not f then
vis:info('No build log yet — run a build first')
return
end
-- keep only the path.odin:line:col: lines; the log comes from a pty, so
-- strip colour escapes and carriage returns first
local errors = {}
for line in f:lines() do
local clean = line:gsub('\27%[[%d;?]*%a', ''):gsub('\r', '')
if clean:match(ERROR_PATTERN) then table.insert(errors, clean) end
end
f:close()
if #errors == 0 then
vis:info('No errors in the last build')
return
end
local tmp = os.tmpname()
f = io.open(tmp, 'w')
if not f then
vis:info('errors: cannot write temp file')
return
end
f:write(table.concat(errors, '\n'), '\n')
f:close()
local cmd = fzf('errors> ', {
'--no-sort', -- keep build order: the first error is the one to fix first
'--delimiter :',
opt('--preview', PREVIEW_AT),
opt('--preview-window', 'down:75%:border-top:+{2}/2'),
opt('--bind', KEYS_NAV),
opt('--bind', KEYS_PREVIEW),
}) .. ' < ' .. q(tmp)
local out = run_fzf(cmd)
os.remove(tmp)
local choice = out and out[1]
if not choice or choice == '' then return end
local path, line, col = choice:match(ERROR_PATTERN)
if not path or not open_path(path) then return end
vis.win.selection:to(tonumber(line), tonumber(col))
end
-- ---------------------------------------------------------------------------
-- fm: browse/create/rename/delete in yazi, then open the file you pick
-- ---------------------------------------------------------------------------
function M.fm()
local tmp = os.tmpname()
os.execute(string.format("yazi --chooser-file='%s' </dev/tty >/dev/tty 2>&1", tmp))
restore_screen()
local f = io.open(tmp, 'r')
local path = f and f:read('*l')
if f then f:close() end
os.remove(tmp)
if path and path ~= '' then open_path(path) end
end
-- ---------------------------------------------------------------------------
-- git: run gitu, then hand the screen back to vis
-- ---------------------------------------------------------------------------
function M.git()
tty_write('\27[?1049l')
os.execute('gitu </dev/tty >/dev/tty 2>&1')
restore_screen()
-- gitu may have changed files on disk (checkout, discard, stash, ...):
-- reload the current buffer if there's nothing unsaved to lose
local win = vis.win
if win and win.file and win.file.path and not win.file.modified then
vis:command('e!')
end
end
-- ---------------------------------------------------------------------------
-- events
-- ---------------------------------------------------------------------------
-- create missing parent directories on save, so a new file like
-- src/util/new.odin can be written even if src/util/ doesn't exist yet
vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path) -- luacheck: no unused args
local dir = path and path:match('^(.*)/[^/]+$')
if dir and dir ~= '' then
os.execute('mkdir -p ' .. q(dir))
end
return true
end)
return M
Submodule config/vis/plugins/vis-commentary deleted from 223dcc6f3f
Submodule config/vis/plugins/vis-ctags deleted from 40a537beaf
Submodule config/vis/plugins/vis-paw deleted from 4feb85ab03
-59
View File
@@ -1,59 +0,0 @@
-- vis-minimal-jellybeans-soft
-- Dark neutral background, warm off-white, and muted, low-brightness accents
local bg_dark = '#131313' -- Dark off-black background instead of harsh pure black
local black1 = '#303030'
local black2 = '#585858'
local offwhite0 = '#b9b9b9' -- Softened off-white base (reduces glare)
local offwhite1 = '#b0b0b0'
local offwhite2 = '#888888'
local clear0 = '#00000000'
-- Darkened, lower-contrast Jellybeans accents
local jelly_yellow_muted = '#d9b36a' -- Subdued warm yellow (Methods / Functions)
local jelly_blue_muted = '#75a0bc' -- Muted ice blue (Types / Classes)
local lexers = vis.lexers
-- Default Softened Base
lexers.STYLE_DEFAULT = 'back:'..clear0..',fore:'..offwhite0
lexers.STYLE_NOTHING = 'back:'..bg_dark
lexers.STYLE_COMMENT = 'fore:'..black2
lexers.STYLE_ERROR = 'fore:'..offwhite0
lexers.STYLE_WHITESPACE = ''
lexers.STYLE_EMBEDDED = 'back:'..black1
-- The ONLY Colored Highlights (Deepened / Softened)
lexers.STYLE_FUNCTION = 'fore:'..jelly_yellow_muted
lexers.STYLE_TYPE = 'fore:'..jelly_blue_muted
lexers.STYLE_CLASS = 'fore:'..jelly_blue_muted
-- Neutral / Off-White Text
lexers.STYLE_VARIABLE = 'fore:'..offwhite0
lexers.STYLE_IDENTIFIER = 'fore:'..offwhite0
lexers.STYLE_KEYWORD = 'fore:'..offwhite2
lexers.STYLE_CONSTANT = 'fore:'..offwhite0
lexers.STYLE_DEFINITION = 'fore:'..offwhite0
lexers.STYLE_LABEL = 'fore:'..offwhite0
lexers.STYLE_NUMBER = 'fore:'..offwhite1
lexers.STYLE_OPERATOR = 'fore:'..offwhite0
lexers.STYLE_REGEX = 'fore:'..offwhite1
lexers.STYLE_STRING = 'fore:'..offwhite1
lexers.STYLE_PREPROCESSOR= 'fore:'..offwhite0
lexers.STYLE_TAG = 'fore:'..offwhite0
-- Editor Interface UI
lexers.STYLE_LINENUMBER = 'fore:'..black2
lexers.STYLE_LINENUMBER_CURSOR = 'fore:'..offwhite1
lexers.STYLE_CURSOR = 'back:'..offwhite2
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:'..bg_dark
lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'back:'..black1
lexers.STYLE_SELECTION = 'back:'..black1
lexers.STYLE_STATUS = 'reverse'
lexers.STYLE_STATUS_FOCUSED = 'back:'..black1..',fore:'..offwhite1
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
lexers.STYLE_INFO = 'fore:default,back:default'
lexers.STYLE_EOF = ''
-36
View File
@@ -1,36 +0,0 @@
local lexers = vis.lexers
lexers.STYLE_DEFAULT = 'fore:#d7d7d7,back:#131313'
lexers.STYLE_NOTHING = ''
lexers.STYLE_CLASS = 'fore:#c4bd97'
lexers.STYLE_COMMENT = 'fore:#7d6d5d'
lexers.STYLE_CONSTANT = 'fore:#cdadad,bold'
lexers.STYLE_DEFINITION = 'fore:#f2d1af,bold'
lexers.STYLE_ERROR = 'fore:#8bc8aa,back:#303030,bold'
lexers.STYLE_FUNCTION = 'fore:#7a96b0'
lexers.STYLE_KEYWORD = 'fore:#787879,bold'
lexers.STYLE_LABEL = 'fore:#7a96b0'
lexers.STYLE_NUMBER = 'fore:#87d7d7'
lexers.STYLE_OPERATOR = 'fore:#d5ce90'
lexers.STYLE_REGEX = 'fore:#d0c195'
lexers.STYLE_STRING = 'fore:#6c836c'
lexers.STYLE_PREPROCESSOR = 'fore:#f2d1af,bold'
lexers.STYLE_TAG = 'fore:#cdadad,bold'
lexers.STYLE_TYPE = 'fore:#7a96b0,bold'
lexers.STYLE_VARIABLE = 'fore:#c9ba9c'
lexers.STYLE_WHITESPACE = ''
lexers.STYLE_EMBEDDED = 'fore:#c09494'
lexers.STYLE_IDENTIFIER = ''
lexers.STYLE_LINENUMBER = 'fore:#585858'
lexers.STYLE_LINENUMBER_CURSOR = 'fore:#666666'
lexers.STYLE_CURSOR = 'back:#585858,keep_attribute'
lexers.STYLE_CURSOR_PRIMARY = 'fore:#1c1c1c,back:#87afaf,bold,keep_attribute'
lexers.STYLE_CURSOR_LINE = 'back:#444444,keep_attribute'
lexers.STYLE_COLOR_COLUMN = 'back:#444444'
lexers.STYLE_SELECTION = 'back:#4a604a'
lexers.STYLE_STATUS = 'back:#262626,fore:#6c836c'
lexers.STYLE_STATUS_FOCUSED = 'back:#303030,fore:#cacaca,bold'
lexers.STYLE_SEPARATOR = ''
lexers.STYLE_INFO = ''
lexers.STYLE_EOF = 'fore:#585858'
-111
View File
@@ -1,111 +0,0 @@
require('vis')
require('plugins/vis-ctags')
require("plugins/vis-commentary")()
require("plugins/vis-paw")
local build = require('build')
local pickers = require('pickers')
-- ---------------------------------------------------------------------------
-- Global options, key mappings and commands
-- ---------------------------------------------------------------------------
vis.events.subscribe(vis.events.INIT, function()
vis:command('set escdelay 1')
vis:command('set autoindent off')
vis:command('set ignorecase on')
vis:command('set theme custom_zen')
-- jump list
vis:map(vis.modes.NORMAL, "<M-j>", "g>")
vis:map(vis.modes.NORMAL, "<M-k>", "g<")
-- pickers
vis:map(vis.modes.NORMAL, '<C-p>', pickers.files, 'Fuzzy find / create a file')
vis:map(vis.modes.NORMAL, '<C-f>', pickers.grep, 'Live grep the project with ripgrep')
vis:map(vis.modes.VISUAL, '<C-f>', pickers.grep_selection, 'Live grep for the selected text')
vis:map(vis.modes.NORMAL, '<C-e>', pickers.fm, 'terminal file manager')
vis:map(vis.modes.NORMAL, '<M-e>', pickers.errors, 'Browse errors from the last build')
-- picker commands
vis:command_register('files', function() pickers.files() return true end, 'Fuzzy find / create a file')
vis:command_register('grep', function() pickers.grep() return true end, 'Live grep the project with ripgrep')
vis:command_register('fm', function() pickers.fm() return true end, 'Pick a file with a terminal file manager')
vis:command_register('git', function() pickers.git() return true end, 'Open gitu')
vis:command_register('errors', function() pickers.errors() return true end, 'Browse errors from the last build')
-- build.sh setup
vis:map(vis.modes.NORMAL, '<C-b>', function() build.run({}) end, 'Run ./build.sh')
vis:command_register('build', function(argv)
local args = {}
for i = 1, #argv do table.insert(args, argv[i]) end
build.run(args)
return true
end, 'Run ./build.sh with optional flags, e.g :build run')
-- system clipboard
local function clip_copy()
vis:feedkeys(':>wl-copy 2>/dev/null<Enter>')
vis:feedkeys('<Escape>') -- drop the selection / leave visual mode
end
local function clip_paste()
vis:feedkeys(':<wl-paste --no-newline<Enter>')
vis:feedkeys('<Escape>') -- clear any selection left on the pasted text
end
vis:map(vis.modes.VISUAL, '<C-c>', clip_copy, 'Copy selection to system clipboard')
vis:map(vis.modes.VISUAL, '<C-v>', clip_paste, 'Paste system clipboard at cursor')
vis:map(vis.modes.NORMAL, '<C-v>', clip_paste, 'Paste system clipboard at cursor')
-- ctag navigation
vis:map(vis.modes.NORMAL, 'gd', '<C-]>', 'Go to definition (ctags picker)')
vis:map(vis.modes.NORMAL, '<C-l>', '<C-t>', 'Go to previous definition (ctags picker)')
end)
-- ---------------------------------------------------------------------------
-- Per-window options
-- ---------------------------------------------------------------------------
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
vis:command('set tabwidth 4')
vis:command('set expandtab on')
-- vis:command('set number on')
end)
-- ---------------------------------------------------------------------------
-- Syntax highlighting: ~/.config/vis/lexers/odin.lua
-- ---------------------------------------------------------------------------
if vis.ftdetect then
-- vis 0.9 and earlier
if vis.ftdetect.filetypes then
vis.ftdetect.filetypes.odin = { ext = { '%.odin$' } }
end
end
-- ---------------------------------------------------------------------------
-- On save: strip trailing spaces/tabs and extra blank lines at the end of
-- the file. Skips files where trailing whitespace means something.
-- ---------------------------------------------------------------------------
local keep_whitespace = { md = true, markdown = true, diff = true, patch = true }
vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path)
local ext = path and path:match('%.(%w+)$')
if ext and keep_whitespace[ext:lower()] then return true end
-- trailing spaces/tabs (not \r, so CRLF files stay CRLF);
-- read every line first, then rewrite only the ones that changed
local trimmed, n = {}, 0
for line in file:lines_iterator() do
n = n + 1
local s = line:find('[ \t]+$')
if s then trimmed[n] = line:sub(1, s - 1) end
end
for i, line in pairs(trimmed) do file.lines[i] = line end
-- blank lines at the end: keep exactly one final newline
local size = file.size
local tail = file:content(math.max(0, size - 256), math.min(size, 256))
local extra = tail:match('\n(\n+)$')
if extra then file:delete(size - #extra, #extra) end
return true
end)
-119
View File
@@ -1,119 +0,0 @@
[app]
overall = { bg = "#131313" }
[icon]
dirs = []
prepend_conds = [ { if = "dir", text = ">", fg = "#7a96b0" } ]
[mgr]
cwd = { fg = "#7a96b0", bold = true }
find_keyword = { fg = "#f2d1af", bold = true }
find_position = { fg = "#87d7d7" }
symlink_target = { fg = "#87afaf", italic = true }
marker_copied = { fg = "#6c836c", bg = "#6c836c" }
marker_cut = { fg = "#cdadad", bg = "#cdadad" }
marker_marked = { fg = "#f2d1af", bg = "#f2d1af" }
marker_selected = { fg = "#7a96b0", bg = "#7a96b0" }
count_copied = { fg = "#131313", bg = "#6c836c" }
count_cut = { fg = "#131313", bg = "#cdadad" }
count_selected = { fg = "#131313", bg = "#7a96b0" }
border_style = { fg = "#585858" }
# code preview uses the same theme file as bat
syntect_theme = "/home/jason/.config/bat/themes/custom_zen.tmTheme"
[indicator]
parent = { bg = "#303030" }
current = { bg = "#444444" }
preview = { bg = "#303030" }
[tabs]
active = { fg = "#131313", bg = "#7a96b0", bold = true }
inactive = { fg = "#d7d7d7", bg = "#303030" }
[mode]
normal_main = { fg = "#131313", bg = "#7a96b0", bold = true }
normal_alt = { fg = "#7a96b0", bg = "#303030" }
select_main = { fg = "#131313", bg = "#6c836c", bold = true }
select_alt = { fg = "#6c836c", bg = "#303030" }
unset_main = { fg = "#131313", bg = "#cdadad", bold = true }
unset_alt = { fg = "#cdadad", bg = "#303030" }
[status]
overall = { fg = "#d7d7d7", bg = "#262626" }
perm_sep = { fg = "#585858" }
perm_type = { fg = "#7a96b0" }
perm_read = { fg = "#a0a0a0" }
perm_write = { fg = "#cdadad" }
perm_exec = { fg = "#6c836c" }
progress_label = { fg = "#d7d7d7", bold = true }
progress_normal = { fg = "#7a96b0", bg = "#303030" }
progress_error = { fg = "#cdadad", bg = "#303030" }
[which]
border = { fg = "#585858" }
mask = { bg = "#262626" }
cand = { fg = "#87d7d7" }
rest = { fg = "#585858" }
desc = { fg = "#a0a0a0" }
separator_style = { fg = "#585858" }
[confirm]
border = { fg = "#7a96b0" }
title = { fg = "#7a96b0" }
btn_yes = { fg = "#131313", bg = "#7a96b0" }
btn_no = { fg = "#d7d7d7", bg = "#303030" }
[spot]
border = { fg = "#7a96b0" }
title = { fg = "#7a96b0" }
tbl_col = { fg = "#7a96b0" }
tbl_cell = { fg = "#d7d7d7", bg = "#444444" }
[notify]
title_info = { fg = "#6c836c" }
title_warn = { fg = "#f2d1af" }
title_error = { fg = "#cdadad" }
[pick]
border = { fg = "#7a96b0" }
active = { fg = "#cdadad", bold = true }
[input]
border = { fg = "#7a96b0" }
selected = { bg = "#4a604a" }
[cmp]
border = { fg = "#7a96b0" }
active = { bg = "#444444" }
[tasks]
border = { fg = "#7a96b0" }
hovered = { fg = "#cdadad", underline = true }
[help]
border = { fg = "#585858" }
chord = { fg = "#87d7d7" }
action = { fg = "#6c836c" }
hovered = { bg = "#444444" }
[filetype]
rules = [
# images
{ mime = "image/*", fg = "#87d7d7" },
# audio / video
{ mime = "{audio,video}/*", fg = "#f2d1af" },
# archives
{ mime = "application/{zip,gzip,x-tar,x-bzip*,x-xz,x-7z-compressed,x-rar}", fg = "#cdadad" },
# documents
{ mime = "application/{pdf,doc,rtf}", fg = "#a0a0a0" },
# special files
{ url = "*", is = "orphan", fg = "#131313", bg = "#cdadad" },
{ url = "*", is = "exec", fg = "#6c836c" },
# directories
{ url = "*/", fg = "#7a96b0" },
]