mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 18:28:19 +00:00
vim-patch:8.2.2452: no completion for the 'filetype' option
Problem: No completion for the 'filetype' option.
Solution: Add filetype completion. (Martin Tournoij, closes vim/vim#7747)
d5e8c92816
This commit is contained in:
@@ -2086,9 +2086,12 @@ int was_set_insecurely(win_T *const wp, char_u *opt, int opt_flags)
|
||||
|
||||
/// 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.
|
||||
/// NOTE: Caller must make sure that "wp" is set to the window from which
|
||||
/// the option is used.
|
||||
static uint32_t *insecure_flag(win_T *const wp, int opt_idx, int opt_flags)
|
||||
{
|
||||
if (opt_flags & OPT_LOCAL)
|
||||
if (opt_flags & OPT_LOCAL) {
|
||||
assert(wp != NULL);
|
||||
switch ((int)options[opt_idx].indir) {
|
||||
case PV_STL: return &wp->w_p_stl_flags;
|
||||
case PV_FDE: return &wp->w_p_fde_flags;
|
||||
@@ -2097,6 +2100,7 @@ static uint32_t *insecure_flag(win_T *const wp, int opt_idx, int opt_flags)
|
||||
case PV_FEX: return &wp->w_buffer->b_p_fex_flags;
|
||||
case PV_INEX: return &wp->w_buffer->b_p_inex_flags;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing special, return global flags field.
|
||||
return &options[opt_idx].flags;
|
||||
@@ -6178,6 +6182,8 @@ set_context_in_set_cmd(
|
||||
xp->xp_backslash = XP_BS_THREE;
|
||||
else
|
||||
xp->xp_backslash = XP_BS_ONE;
|
||||
} else if (p == (char_u *)&p_ft) {
|
||||
xp->xp_context = EXPAND_FILETYPE;
|
||||
} else {
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
// for 'tags' need three backslashes for a space
|
||||
|
@@ -900,6 +900,7 @@ return {
|
||||
normal_fname_chars=true,
|
||||
vi_def=true,
|
||||
alloced=true,
|
||||
expand=true,
|
||||
varname='p_ft',
|
||||
defaults={if_true={vi=""}}
|
||||
},
|
||||
|
@@ -230,6 +230,13 @@ func Test_set_completion()
|
||||
call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
|
||||
set tags&
|
||||
|
||||
" 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(), @:)
|
||||
call assert_equal('"set filetype=' .. join(getcompletion('a*', 'filetype')), @:)
|
||||
endfunc
|
||||
|
||||
func Test_set_errors()
|
||||
|
Reference in New Issue
Block a user