From b21980bd607e952fe52957aec3214367bd48527b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 29 Aug 2022 05:58:32 +0800 Subject: fix(keywordprg): default to :help if set to empty string (#19983) --- src/nvim/normal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 31646f686d..cab380003d 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -4278,13 +4278,12 @@ static void nv_ident(cmdarg_T *cap) // double the length of the word. p_kp / curbuf->b_p_kp could be added // and some numbers. char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : (char_u *)curbuf->b_p_kp; // 'keywordprg' - assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty. - bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command - bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); + bool kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); if (kp_help && *skipwhite(ptr) == NUL) { emsg(_(e_noident)); // found white space only return; } + bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command size_t buf_size = n * 2 + 30 + STRLEN(kp); char *buf = xmalloc(buf_size); buf[0] = NUL; -- cgit