vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 422d4469743724125c7d2e99716290d198a9fc8c
parent 246e4e5bb85b1b7e5bdfa0ff0b1c6e98174c9a13
Author: Matěj Cepl <mcepl@cepl.eu>
Date:   Sat,  8 Feb 2025 09:18:24 +0100

complete-filename: speed-up the tilda handling

Diffstat:
Mlua/plugins/complete-filename.lua | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lua/plugins/complete-filename.lua b/lua/plugins/complete-filename.lua @@ -23,9 +23,10 @@ local complete_filename = function(expand) end -- Expand tilda for the home directory - if prefix:find('^~') then + _, j = prefix:find('^~') + if j ~= nil then local home = assert(os.getenv("HOME"), "$HOME variable not set!") - prefix = prefix:gsub("^~", home, 1) + prefix = home .. prefix:sub(j + 1) end local cmdfmt = "vis-complete --file '%s'"