dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

Commit: da452ffad490c1cd16702985e91d24ba2fbe1a40
Parent: 77faa96c9385648f49ddc6ca9bf6c5b248e12ec5
Author: Randy Palamar
Date:   Sat,  6 May 2023 23:06:33 -0600

vis: properly export util module and use local variables correctly

Diffstat:
M.config/vis/build.lua | 6+++---
M.config/vis/util.lua | 4++--
M.config/vis/visrc.lua | 9+++++----
3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/.config/vis/build.lua b/.config/vis/build.lua @@ -1,4 +1,4 @@ -require('util') +local util = require('util') local function fmt_file(file) local win = vis.win @@ -32,13 +32,13 @@ local function build_files(win) local err, ostr = vis:pipe(f, {start = 0, finish = 0}, cmd) if err ~= 0 then if ostr then - util:message_clear(vis) + util.message_clear(vis) vis:message(ostr) end return false end - local fp = util:splitext(f.name) + local fp = util.splitext(f.name) -- update refrences vis:command("!biber " .. fp .. " >/dev/null") -- update glossary diff --git a/.config/vis/util.lua b/.config/vis/util.lua @@ -1,13 +1,13 @@ local util = {} -function util:splitext(file) +function util.splitext(file) if file == nil then return nil, nil end local i = file:reverse():find('%.') if i == nil then return file, nil end return file:sub(0, -(i + 1)), file:sub(-i) end -function util:message_clear(vis) +function util.message_clear(vis) vis:message("") -- hack: focus the message window vis.win.file:delete(0, vis.win.file.size) end diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua @@ -1,14 +1,15 @@ require('vis') -require('util') require('build') require('macros') require('plugins/vis-gpg') require('plugins/vis-lint') -spell = require('plugins/vis-spellcheck') +local util = require('util') + +local spell = require('plugins/vis-spellcheck') spell.default_lang = "en_US" -mww = 72 -- Min Window Width +local mww = 72 -- Min Window Width vis.events.subscribe(vis.events.INIT, function() vis:command("set theme term") @@ -55,7 +56,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) end) vis.events.subscribe(vis.events.WIN_CLOSE, function(win) - local f, e = util:splitext(win.file.name) + local f, e = util.splitext(win.file.name) if e == '.tex' then vis:command("!texclean " .. f .. e) end