diff --git a/lua/gemini/completion.lua b/lua/gemini/completion.lua index cfb638f..000536d 100644 --- a/lua/gemini/completion.lua +++ b/lua/gemini/completion.lua @@ -205,9 +205,9 @@ function M.trigger_completion() debug_print("Current line: %s, col: %d", current_line or "nil", col) - -- Don't trigger completion if line is empty or cursor is at the start - if not current_line or col == 0 or current_line:match("^%s*$") then - debug_print("Skipping: empty line or cursor at start") + -- Don't trigger completion if line is empty + if not current_line or current_line:match("^%s*$") then + debug_print("Skipping: empty line") clear_suggestion() return end @@ -217,11 +217,10 @@ function M.trigger_completion() debug_print("Prefix: %s", prefix) - -- Don't trigger on certain conditions - if prefix:match("^%s*$") or -- empty or whitespace - prefix:match("[%s%-]$") or -- ends with space or dash - #prefix < 3 then -- too short - debug_print("Skipping: prefix conditions not met") + -- Modified conditions: only skip if the line is completely empty + -- or if we're in the middle of whitespace + if prefix:match("^%s*$") then + debug_print("Skipping: empty prefix") clear_suggestion() return end