mirror of
https://github.com/vim/vim
synced 2025-07-16 17:22:00 +00:00
patch 8.2.2452: no completion for the 'filetype' option
Problem: No completion for the 'filetype' option. Solution: Add filetype completion. (Martin Tournoij, closes #7747)
This commit is contained in:
@ -2419,6 +2419,8 @@ was_set_insecurely(char_u *opt, int opt_flags)
|
|||||||
/*
|
/*
|
||||||
* Get a pointer to the flags used for the P_INSECURE flag of option
|
* Get a pointer to the flags used for the P_INSECURE flag of option
|
||||||
* "opt_idx". For some local options a local flags field is used.
|
* "opt_idx". For some local options a local flags field is used.
|
||||||
|
* NOTE: Caller must make sure that "curwin" is set to the window from which
|
||||||
|
* the option is used.
|
||||||
*/
|
*/
|
||||||
static long_u *
|
static long_u *
|
||||||
insecure_flag(int opt_idx, int opt_flags)
|
insecure_flag(int opt_idx, int opt_flags)
|
||||||
@ -6209,6 +6211,10 @@ set_context_in_set_cmd(
|
|||||||
else
|
else
|
||||||
xp->xp_backslash = XP_BS_ONE;
|
xp->xp_backslash = XP_BS_ONE;
|
||||||
}
|
}
|
||||||
|
else if (p == (char_u *)&p_ft)
|
||||||
|
{
|
||||||
|
xp->xp_context = EXPAND_FILETYPE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xp->xp_context = EXPAND_FILES;
|
xp->xp_context = EXPAND_FILES;
|
||||||
|
@ -946,7 +946,7 @@ static struct vimoption options[] =
|
|||||||
(char_u *)FALSE,
|
(char_u *)FALSE,
|
||||||
#endif
|
#endif
|
||||||
(char_u *)0L} SCTX_INIT},
|
(char_u *)0L} SCTX_INIT},
|
||||||
{"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
{"filetype", "ft", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
||||||
(char_u *)&p_ft, PV_FT,
|
(char_u *)&p_ft, PV_FT,
|
||||||
{(char_u *)"", (char_u *)0L}
|
{(char_u *)"", (char_u *)0L}
|
||||||
SCTX_INIT},
|
SCTX_INIT},
|
||||||
|
@ -332,6 +332,12 @@ func Test_set_completion()
|
|||||||
call feedkeys(":set key=\<Tab>\<C-B>\"\<CR>", 'xt')
|
call feedkeys(":set key=\<Tab>\<C-B>\"\<CR>", 'xt')
|
||||||
call assert_equal('"set key=*****', @:)
|
call assert_equal('"set key=*****', @:)
|
||||||
set key=
|
set key=
|
||||||
|
|
||||||
|
" Expand values for 'filetype'
|
||||||
|
call feedkeys(":set filetype=sshdconfi\<Tab>\<C-B>\"\<CR>", 'xt')
|
||||||
|
call assert_equal('"set filetype=sshdconfig', @:)
|
||||||
|
call feedkeys(":set filetype=a\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||||
|
call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_errors()
|
func Test_set_errors()
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2452,
|
||||||
/**/
|
/**/
|
||||||
2451,
|
2451,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user