diff options
| author | Matěj Cepl <mcepl@cepl.eu> | 2025-02-08 09:18:24 +0100 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2025-02-22 09:04:11 -0700 |
| commit | e8272ea397ca79ef3e1c5b1e17b9cdcd658f3fbd (patch) | |
| tree | 2201da9d0b852ef8839e60b6308c226158c3ffb3 | |
| parent | 826124acef4973608dc52960407d6a92022b9b96 (diff) | |
| download | vis-e8272ea397ca79ef3e1c5b1e17b9cdcd658f3fbd.tar.gz vis-e8272ea397ca79ef3e1c5b1e17b9cdcd658f3fbd.tar.xz | |
complete-filename: speed-up the tilda handling
| -rw-r--r-- | lua/plugins/complete-filename.lua | 5 |
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'" |
