From 6b12eda2201706dbc4705b6e3ca9b17821051e58 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 28 Aug 2023 07:07:50 +0800 Subject: [PATCH] vim-patch:9.0.1798: The 'syntax' option has no completion. (#24908) Problem: The 'syntax' option has no completion. Solution: Add syntax option completion. closes: vim/vim#12900 https://github.com/vim/vim/commit/6dfdff3f273dcea29099d81e3eceb871ae089998 N/A patches: vim-patch:9.0.1795: Indentation issues Co-authored-by: Doug Kearns --- src/nvim/option.c | 5 +++++ test/old/testdir/test_options.vim | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/nvim/option.c b/src/nvim/option.c index 62a93f1293..716fd3775a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5394,6 +5394,11 @@ void set_context_in_set_cmd(expand_T *xp, char *arg, int opt_flags) xp->xp_pattern = p + 1; + if (options[opt_idx].var == &p_syn) { + xp->xp_context = EXPAND_OWNSYNTAX; + return; + } + if (flags & P_EXPAND) { p = options[opt_idx].var; if (p == (char *)&p_bdir diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 563709b9a3..c56efe8786 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -378,6 +378,12 @@ func Test_set_completion() call assert_equal('"set filetype=sshdconfig', @:) call feedkeys(":set filetype=a\\\"\", 'xt') call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:) + + " Expand values for 'syntax' + call feedkeys(":set syntax=sshdconfi\\\"\", 'xt') + call assert_equal('"set syntax=sshdconfig', @:) + call feedkeys(":set syntax=a\\\"\", 'xt') + call assert_equal('"set syntax=' .. getcompletion('a*', 'syntax')->join(), @:) endfunc func Test_set_option_errors()