vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 054f4aa21aa6d5922030cde5fa7b983ce5b6e359 parent 7757c8114a854578eb8ad6d737cbacd402249c20 Author: Matěj Cepl <mcepl@cepl.eu> Date: Sun, 19 Jan 2025 17:34:09 +0100 complete-filename: complete tilda as $HOME as well Diffstat:
| M | lua/plugins/complete-filename.lua | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/lua/plugins/complete-filename.lua b/lua/plugins/complete-filename.lua @@ -22,6 +22,12 @@ local complete_filename = function(expand) range.finish = pos end + -- Expand tilda for the home directory + if prefix:find('^~') then + local home = assert(os.getenv("HOME"), "$HOME variable not set!") + prefix = prefix:gsub("^~", home, 1) + end + local cmdfmt = "vis-complete --file '%s'" if expand then cmdfmt = "vis-open -- '%s'*" end local status, out, err = vis:pipe(cmdfmt:format(prefix:gsub("'", "'\\''")))