Skip to content

Commit

Permalink
lua: complete-filename: use biggest possible prefix
Browse files Browse the repository at this point in the history
This allows for example to complete file names in markdown images.

E.g.:    ![](pic<C-x><C-f>    will complete the file name.

Previously it would have detected the '[' as prefix.
  • Loading branch information
fischerling authored and rnpnr committed May 1, 2024
1 parent 675ab49 commit 4d5bfb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/plugins/complete-filename.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local complete_filename = function(expand)
if not prefix then return end

-- Strip leading delimiters for some programming languages
local _, j = prefix:find("[{[(<'\"]+")
local _, j = prefix:find(".*[{[(<'\"]+")
if not expand and j then prefix = prefix:sub(j + 1) end

if prefix:match("^%s*$") then
Expand Down

0 comments on commit 4d5bfb8

Please sign in to comment.