]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vimcomplete): do not complete on empty line
authorMaxim Kim <habamax@gmail.com>
Mon, 13 Oct 2025 18:58:17 +0000 (18:58 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 13 Oct 2025 18:58:17 +0000 (18:58 +0000)
closes: #18561

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/vimcomplete.vim

index d75dfe634da53371b2e8ea394dfee053d3031d2d..0de3bf2dbf9045d9943c85897569ec933610100f 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim completion script
 # Language:    Vim script
 # Maintainer:  Maxim Kim <habamax@gmail.com>
-# Last Change: 2025-08-27
+# Last Change: 2025-10-13
 #
 # Usage:
 # setlocal omnifunc=vimcomplete#Complete
@@ -36,6 +36,9 @@ enddef
 export def Complete(findstart: number, base: string): any
     if findstart > 0
         var line = getline('.')->strpart(0, col('.') - 1)
+        if line =~ '\s\+$'
+            return -2
+        endif
         var keyword = line->matchstr('\k\+$')
         var stx = synstack(line('.'), col('.') - 1)->map('synIDattr(v:val, "name")')->join()
         if stx =~? 'Comment' || (stx =~ 'String' && stx !~ 'vimStringInterpolationExpr')