aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/plugins/complete-filename.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/lua/plugins/complete-filename.lua b/lua/plugins/complete-filename.lua
index 02b9f3a..604361c 100644
--- 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'"