aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/plugins/complete-filename.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/lua/plugins/complete-filename.lua b/lua/plugins/complete-filename.lua
index 43cf14b..02b9f3a 100644
--- 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("'", "'\\''")))