Skip to content

Commit 9da629b

Browse files
committed
fix(cmdline): skip path completion handler when using vim expressions
Closes #1922
1 parent 9c5d823 commit 9da629b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lua/blink/cmp/sources/cmdline/init.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ local path_lib = require('blink.cmp.sources.path.lib')
1515
local function smart_split(context, is_path_completion)
1616
local line = context.line
1717

18-
if is_path_completion then
18+
local function contains_vim_expr(line)
19+
-- Checks for common Vim expressions: %, #, %:h, %:p, etc.
20+
return line:find('%%[:#]') or line:find('%% ') or line:find('#')
21+
end
22+
23+
if is_path_completion and not contains_vim_expr(line) then
1924
-- Split the line into tokens, respecting escaped spaces in paths
2025
local tokens = path_lib:split_unescaped(line:gsub('^%s+', ''))
2126
local cmd = tokens[1]

0 commit comments

Comments
 (0)