[vim/vim] runtime(vimscript): add simple vimscript complete function (PR #17871)

65 views
Skip to first unread message

Maxim Kim

unread,
Jul 28, 2025, 4:45:26 AM7/28/25
to vim/vim, Subscribed

I have come up with a simple omnicomplete function for vimscript to complete different things (commands, functions, global/buffer variables, expressions, highlight command).

It works nicely with the set autocomplete. While it is not super smart, it might be better than nothing and as usual there is a room for future improvements.

To enable set omnifunc=vimcomplete#Complete:

asciicast

@chrisbra, @girishji, @lifepillar, @yegappan could you please check if it works for you? And in general if it makes sense to put it into vim's core.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/17871

Commit Summary

  • e194253 add simple vimscript complete function

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871@github.com>

Maxim Kim

unread,
Jul 28, 2025, 6:00:44 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • 162e02e better `set option option=value,value2` complete


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/e194253531a36769ce7097b513586c0e5df1cbc4/after/162e02e43cbf45743a7d544a69359b807121627f@github.com>

girish

unread,
Jul 28, 2025, 6:05:21 AM7/28/25
to vim/vim, Subscribed
girishji left a comment (vim/vim#17871)

You may be missing some entries from 'cmdline'. Take a look at this: https://github.com/girishji/vimcomplete/blob/main/tools/vimdictgen.vim


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3126497366@github.com>

Maxim Kim

unread,
Jul 28, 2025, 6:14:36 AM7/28/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

You may be missing some entries from 'cmdline'. Take a look at this: https://github.com/girishji/vimcomplete/blob/main/tools/vimdictgen.vim

Thx, will check it.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3126530815@github.com>

Maxim Kim

unread,
Jul 28, 2025, 6:17:12 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • 2b1f571 set omnifunc in vim's ftplugin

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/162e02e43cbf45743a7d544a69359b807121627f/after/2b1f571b127a714810f93e8ca78ccef8200f41a7@github.com>

Shougo

unread,
Jul 28, 2025, 6:26:42 AM7/28/25
to vim/vim, Subscribed
Shougo left a comment (vim/vim#17871)

I think getcompletiontype() is better to parse Vim script.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3126572630@github.com>

Maxim Kim

unread,
Jul 28, 2025, 6:31:20 AM7/28/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

I think getcompletiontype() is better to parse Vim script.

I tried it but it can't do &option as in echo getcompletiontype("&option") is a command which is not what I want to complete. So I went full regex parsing instead.

Maybe it could be used in some parts of the code, let me see.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3126589999@github.com>

Maxim Kim

unread,
Jul 28, 2025, 7:02:10 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • f9a5e59 use getcompletiontype() as a fallback

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/2b1f571b127a714810f93e8ca78ccef8200f41a7/after/f9a5e590cda98f88f17276e2133f502dbea2249d@github.com>

Maxim Kim

unread,
Jul 28, 2025, 7:34:50 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/f9a5e590cda98f88f17276e2133f502dbea2249d/after/677a06f2e8330ab1c71bf715ae24b402e2e3b5ff@github.com>

Lifepillar

unread,
Jul 28, 2025, 7:38:22 AM7/28/25
to vim/vim, Subscribed
lifepillar left a comment (vim/vim#17871)

Is this meant to replace (and augment) Vim command completion (CTRL-X CTRL-V)? If so, I'd recommend comparing the respective outputs in as many contexts as possible.

Regardless, these are a couple of examples where things need probably to be improved:

Vim completion:

Normal-vim-cmd.png (view on web) cterm-vim-cmd.png (view on web)

Omni-completion (this PR):

Normal-omni.png (view on web) cterm-omni.png (view on web)

Omni-completion seems to order matches such that the closest match is not always at the top.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3126820035@github.com>

Maxim Kim

unread,
Jul 28, 2025, 8:17:44 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • f4d54af use either fuzzy or stridx depending on 'completeopt'

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/677a06f2e8330ab1c71bf715ae24b402e2e3b5ff/after/f4d54af222780608022456c51d67f416e38e138f@github.com>

Maxim Kim

unread,
Jul 28, 2025, 8:25:40 AM7/28/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

@lifepillar thx for the feedback -- I didn't properly test it without set autocomlete and missed the part of where I had to filter 'augmented' values as well.

The difference with CTRL-X CTRL-V is that omnicomplete function works with set autocomplete provided you have added setlocal complete+=o to your filetype. And of course the fact that we can improve completion way easier using vimscript instead of getting into C source code.

It can't complete &option or expression/function and probably some more.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3126992893@github.com>

Maxim Kim

unread,
Jul 28, 2025, 9:32:19 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • a4c19ba simplify completion logic: mostly rely on getcompletion

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/f4d54af222780608022456c51d67f416e38e138f/after/a4c19baa1f625fa143e864e7e1ef03d9eb0fdaa7@github.com>

Maxim Kim

unread,
Jul 28, 2025, 9:48:31 AM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • 78808fd complete commands and functions

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/a4c19baa1f625fa143e864e7e1ef03d9eb0fdaa7/after/78808fd62dc0a8e1bfaa044ac086de7ba2cb725a@github.com>

Phạm Bình An

unread,
Jul 28, 2025, 8:45:02 PM7/28/25
to vim/vim, Subscribed
brianhuster left a comment (vim/vim#17871)

The difference with CTRL-X CTRL-V is that omnicomplete function works with set autocomplete provided you have added setlocal complete+=o to your filetype. And of course the fact that we can improve completion way easier using vimscript instead of getting into C source code.

So do you plan to make Ctrl-x Ctrl-v just call this omnifunc?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3130218294@github.com>

Maxim Kim

unread,
Jul 28, 2025, 9:13:01 PM7/28/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

So do you plan to make Ctrl-x Ctrl-v just call this omnifunc?

I don't think this is easily possible tbh, but getcompletion with getcompletiontype does the job for me (with a bit of additional regex handling)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3130252573@github.com>

Maxim Kim

unread,
Jul 28, 2025, 10:47:01 PM7/28/25
to vim/vim, Push

@habamax pushed 1 commit.

  • 6cd8c5e re-add complete in interpolated vim string

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/before/78808fd62dc0a8e1bfaa044ac086de7ba2cb725a/after/6cd8c5e4ea7c58cc1724bbb6a257e4317173aea9@github.com>

Maxim Kim

unread,
Jul 28, 2025, 11:03:29 PM7/28/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

should be good to check it again

asciicast


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3130448368@github.com>

girish

unread,
Jul 29, 2025, 12:58:11 AM7/29/25
to vim/vim, Subscribed
girishji left a comment (vim/vim#17871)

Does (Ctrl-X Ctrl-V) provide more relevant completions than this script?

Also, when I tried this on the Vim source (with a ~5 MB tag file), I noticed some slight hiccups—maybe around 0.5 seconds—which felt a bit annoying.

Is it doing a regex search on the tag file every time?

Maybe you could cache the entire tag file into a Vim dictionary and query that instead?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3130695164@github.com>

Maxim Kim

unread,
Jul 29, 2025, 4:51:59 AM7/29/25
to vim_dev
I can't see this message on github, you probably deleted it?

There is no tag scanning so if anything was slowing your vim, it was something else.

Hopefully, +1 added by you on my message there means there is no issue related to this omnifunc.

Phạm Bình An

unread,
Jul 29, 2025, 6:11:46 AM7/29/25
to vim/vim, Subscribed
brianhuster left a comment (vim/vim#17871)

oh did you mean to use omnifunc when user presses ctrl-x ctrl-v? No I don't plan it.

Basically I mean to just reimplement Ctrl-x_Ctrl-v in Vim9script (the command could still be defined in C, but its logic is in Vim9script). I can't see a reason why there are 2 versions (one in C, one in Vim9script) of very similar feature.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3131725598@github.com>

Maxim Kim

unread,
Jul 29, 2025, 6:24:10 AM7/29/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

oh did you mean to use omnifunc when user presses ctrl-x ctrl-v? No I don't plan it.

Basically I mean to just reimplement Ctrl-x_Ctrl-v in Vim9script (the command could still be defined in C, but its logic is in Vim9script). That avoids unnecessarily duplicating code and logic.

I see, however it is not related to this PR, it needs another one.

Feature omnifunc exists quite for a while and I don't see a reason why we shouldn't have the one for vimscript.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3131777571@github.com>

Shougo

unread,
Jul 29, 2025, 8:38:38 PM7/29/25
to vim/vim, Subscribed
Shougo left a comment (vim/vim#17871)

I tried it but it can't do &option as in echo getcompletiontype("&option") is a command which is not what I want to complete. So I went full regex parsing instead.

Yes. But you can use the pattern. getcompletiontype("echo &op") works.
You can use the full command line to parse.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3134508805@github.com>

Maxim Kim

unread,
Jul 29, 2025, 8:48:42 PM7/29/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

Yes. But you can use the pattern. getcompletiontype("echo &op") works.


You can use the full command line to parse.

I use exactly this plus additional regex parsing to be able to complete vim9script &com... as in &commentstring = '// %s'


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3134523875@github.com>

dkearns

unread,
Aug 6, 2025, 10:37:20 AM8/6/25
to vim/vim, Subscribed

@dkearns commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

I suppose this needs some sort of vim9script guard so as not to annoy the Neovimmers.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3092965529@github.com>

Maxim Kim

unread,
Aug 6, 2025, 6:03:25 PM8/6/25
to vim/vim, Subscribed

@habamax commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

Can’t they just not get this in the first place?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3094453872@github.com>

dkearns

unread,
Aug 7, 2025, 11:37:38 AM8/7/25
to vim/vim, Subscribed

@dkearns commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

My understanding is that we are trying to limit the differences in shared runtime files.

$ git grep git grep -r 'has(.vim9script'
runtime/autoload/dist/vim.vim:if !has('vim9script')
runtime/autoload/htmlfold.vim:if !has("vim9script")
runtime/autoload/javaformat.vim:if !has("vim9script")
runtime/doc/version9.txt:Solution:   Add has('vim9script').
runtime/doc/vim9.txt:   if !has('vim9script')
runtime/ftplugin/html.vim:if !has("vim9script")
runtime/ftplugin/java.vim:if !has("vim9script")
runtime/ftplugin/lua.vim:if !has('vim9script')
runtime/indent/racket.vim:if has('vim9script')
runtime/indent/racket.vim:let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')
runtime/syntax/java.vim:if !has("vim9script")


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3097722880@github.com>

Maxim Kim

unread,
Aug 7, 2025, 7:30:00 PM8/7/25
to vim/vim, Subscribed

@habamax commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

I disagree with that, I believe we should target vim in vim project.

But, well...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3099046344@github.com>

Maxim Kim

unread,
Aug 8, 2025, 1:47:45 AM8/8/25
to vim/vim, Subscribed

@habamax commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

And we don’t have the vim9script guard here https://github.com/vim/vim/blob/6a6a44ffb5ad7350a4d313a5faeae17e50bf37a2/runtime/ftplugin/c.vim#L32


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3099535348@github.com>

Christian Brabandt

unread,
Aug 8, 2025, 7:38:48 AM8/8/25
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

Then let's fix it there as well :) (I'll do it when merging this). Thanks all


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100468766@github.com>

Christian Brabandt

unread,
Aug 8, 2025, 7:46:59 AM8/8/25
to vim/vim, Subscribed

Closed #17871 via fa2bcbd.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/issue_event/19053422761@github.com>

Maxim Kim

unread,
Aug 8, 2025, 7:51:40 AM8/8/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17871)

thanks!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3167608072@github.com>

dkearns

unread,
Aug 8, 2025, 8:22:28 AM8/8/25
to vim/vim, Subscribed

@dkearns commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

The completion function for C was added a long time ago, before the change in policy. It was actually rewritten so the Neovim folks just kept the legacy script version.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100623573@github.com>

Maxim Kim

unread,
Aug 8, 2025, 8:39:52 AM8/8/25
to vim/vim, Subscribed

@habamax commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

before the change in policy

It would be nice to see the policy stated in the README or anywhere in the repo.

For me this is a surprise that we are to think about neovim compatibility. That is ok here, as it doesn't cost us anything, just a simple guard. But in general this is not very promising.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100675398@github.com>

Christian Brabandt

unread,
Aug 8, 2025, 9:15:01 AM8/8/25
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

So how about this then:

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8f0947acf..9e187f3d1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -48,7 +48,7 @@ approvers are happy with that particular change.

 # Reporting issues

-We use GitHub issues, but that is not a requirement. Writing to the Vim
+We use GitHub [issues][16], but that is not a requirement. Writing to the Vim
 mailing list is also fine.

 Please use the GitHub issues only for actual issues. If you are not 100% sure
@@ -72,7 +72,8 @@ Or open [the todo file][todo list] on GitHub to see the latest version.

 The latest version of these files can be obtained from the repository.
 They are usually not updated with numbered patches. However, they may
-or may not work with older Vim releases (since they may contain new features).
+or may not work with older Vim releases (since they may depend on new
+features).

 If you find a problem with one of these files or have a suggestion for
 improvement, please first try to contact the maintainer directly.
@@ -82,7 +83,18 @@ upstream repository. You may also check the [MAINTAINERS][11] file.
 The maintainer will take care of issues and send updates to the Vim project for
 distribution with Vim.

-If the maintainer does not respond, contact the [vim-dev][0] mailing list.
+If the maintainer does not respond, contact the [vim-dev][0] mailing list or
+open an [issue][16] here.
+
+Note: Whether or not to use Vim9 Script is up to the maintainer. For runtime
+files maintained here, we aim to preserve compatibility with Neovim if
+possible. Please add wrap Vim9 script with a guard like this:
+```vim
+if has('vim9script')
+   " use Vim9 script implementation
+   [...]
+endif
+```

 ## Contributing new runtime files

@@ -95,6 +107,9 @@ PR with your changes against this repository here. For new filetypes, do not for
 - add yourself as Maintainer to the top of file (again, keep the header similar to
   other runtime files)
 - add yourself to the [MAINTAINERS][11] file.
+- add a guard `if has('vim9script')` if you like to maintain Neovim
+  compatibility but want to use Vim9 script (or restrict yourself to legacy Vim
+  script)

 # Translations

@@ -144,3 +159,4 @@ mailing list. For other questions please use the [Vi Stack Exchange][8] website,
 [14]: https://github.com/vim/vim/blob/master/runtime/doc/syntax.txt
 [15]: https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin
 [16]: https://github.com/vim/vim/blob/master/runtime/doc/helphelp.txt
+[16]: https://github.com/vim/vim/issues


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100786599@github.com>

bfrg

unread,
Aug 8, 2025, 9:50:35 AM8/8/25
to vim/vim, Subscribed

@bfrg commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

vim9script can be disabled when compiling Vim from source. Therefore, the check has('vim9script') is necessary, even in Vim itself. Though, not sure if runtime would work when vim9script is disabled since a few functions in runtime have been ported to vim9script.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100921835@github.com>

zeertzjq

unread,
Aug 8, 2025, 9:55:38 AM8/8/25
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

vim9script can be disabled when compiling Vim from source.

No, there is no feature flag for vim9script.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100938737@github.com>

bfrg

unread,
Aug 8, 2025, 10:02:05 AM8/8/25
to vim/vim, Subscribed

@bfrg commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

Then why is it listed in :version?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100962407@github.com>

zeertzjq

unread,
Aug 8, 2025, 10:07:20 AM8/8/25
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

Look at version.c line 630. It always shows +vim9script (even if FEAT_EVAL is disabled).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3100983871@github.com>

Shane-XB-Qian

unread,
Aug 9, 2025, 2:44:44 AM8/9/25
to vim/vim, Subscribed
Shane-XB-Qian left a comment (vim/vim#17871)
> For me this is a surprise that we are to think about neovim compatibility.

yes, unknown this how come. :smile:
// from last time: "let g:vimsyn_vim_features = ['nvim']" ?
// it is weird, not sure Debian Whether setup something for Ubuntu, or firefox setup something for chrome :lol:

--
shane.xb.qian


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/c3170419625@github.com>

dkearns

unread,
Aug 11, 2025, 6:36:36 AM8/11/25
to vim/vim, Subscribed

@dkearns commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

I don't really understand where the lines are but it's clearly not that simple.

[doug] vim/git/neovim (git)-[master] % git grep -r 'has(.vim9script' runtime
runtime/autoload/dist/vim.vim:if !has('vim9script')
runtime/autoload/htmlfold.vim:if !has("vim9script")
runtime/autoload/javaformat.vim:if !has("vim9script")
runtime/ftplugin/html.vim:if !has("vim9script")
runtime/ftplugin/java.vim:if !has("vim9script")
runtime/indent/racket.vim:if has('vim9script')
runtime/indent/racket.vim:let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')
runtime/syntax/java.vim:if !has("vim9script")


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3105208265@github.com>

Christian Brabandt

unread,
Aug 11, 2025, 8:11:32 AM8/11/25
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

Well, I don't know if such a change to the vim ftplugin would be marked as "Vim9script", however this is done and then
it also does not hurt, plus it helps when a user with Vim8 simply downloads the update plugin files from here (not sure if this is a valid use case).

In any case, that is the best I can do to maintain compatibility with Neovim.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3105525305@github.com>

zeertzjq

unread,
Aug 11, 2025, 8:17:32 AM8/11/25
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

Hmm, then mappings added in c0b3c19 should also be guarded with has('vim9script').


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3105543684@github.com>

Phạm Bình An

unread,
Aug 11, 2025, 8:22:24 AM8/11/25
to vim/vim, Subscribed

@brianhuster commented on this pull request.


In runtime/ftplugin/vim.vim:

> @@ -116,6 +116,9 @@ setlocal include=\\v^\\s*import\\s*(autoload)?
 " set 'define' to recognize export commands
 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
 
+" set omnifunc completion
+setlocal omnifunc=vimcomplete#Complete

I don't really understand where the lines are but it's clearly not that simple

Except for dist/vim.vim, other files seem to maintained by some third parties, they also have upstream Github repo. Nvim users could download the plugin from upstream, so it makes sense to have vim9script guard.

But I just say that is not necessary for plugins maintained by Vim directly and don't have another upstream repo.

it helps when a user with Vim8 simply downloads the update plugin files from here (not sure if this is a valid use case)

It's up to you guys to decide, but I hope not, otherwise you guys will have to add a bunch of version check for very old Vim version (what if user of Vim5 install it?), which make the code uglier and harder to maintain


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/17871/review/3105558504@github.com>

Reply all
Reply to author
Forward
0 new messages