Skip to content

Commit 33aecb1

Browse files
committed
patch 8.2.1984: cannot use :vimgrep in omni completion
Problem: Cannot use :vimgrep in omni completion, causing C completion to fail. Solution: Add the EX_LOCK_OK flag to :vimgrep. (closes #7292)
1 parent f4d61bc commit 33aecb1

3 files changed

Lines changed: 66 additions & 4 deletions

File tree

src/ex_cmds.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,10 @@ EXCMD(CMD_luafile, "luafile", ex_luafile,
929929
EX_RANGE|EX_FILE1|EX_NEEDARG|EX_CMDWIN|EX_LOCK_OK|EX_RESTRICT,
930930
ADDR_LINES),
931931
EXCMD(CMD_lvimgrep, "lvimgrep", ex_vimgrep,
932-
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
932+
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
933933
ADDR_OTHER),
934934
EXCMD(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep,
935-
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
935+
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
936936
ADDR_OTHER),
937937
EXCMD(CMD_lwindow, "lwindow", ex_cwindow,
938938
EX_RANGE|EX_COUNT|EX_TRLBAR,
@@ -1673,10 +1673,10 @@ EXCMD(CMD_view, "view", ex_edit,
16731673
EX_BANG|EX_FILE1|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
16741674
ADDR_NONE),
16751675
EXCMD(CMD_vimgrep, "vimgrep", ex_vimgrep,
1676-
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
1676+
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
16771677
ADDR_OTHER),
16781678
EXCMD(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep,
1679-
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE,
1679+
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
16801680
ADDR_OTHER),
16811681
EXCMD(CMD_vim9script, "vim9script", ex_vim9script,
16821682
EX_CMDWIN|EX_LOCK_OK,

src/testdir/test_quickfix.vim

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,66 @@ func Test_resize_from_copen()
30913091
endtry
30923092
endfunc
30933093

3094+
func Test_vimgrep_with_textlock()
3095+
new
3096+
3097+
" Simple way to execute something with "textwinlock" set.
3098+
" Check that vimgrep without jumping can be executed.
3099+
au InsertCharPre * vimgrep /RunTheTest/j runtest.vim
3100+
normal ax
3101+
let qflist = getqflist()
3102+
call assert_true(len(qflist) > 0)
3103+
call assert_match('RunTheTest', qflist[0].text)
3104+
call setqflist([], 'r')
3105+
au! InsertCharPre
3106+
3107+
" Check that vimgrepadd without jumping can be executed.
3108+
au InsertCharPre * vimgrepadd /RunTheTest/j runtest.vim
3109+
normal ax
3110+
let qflist = getqflist()
3111+
call assert_true(len(qflist) > 0)
3112+
call assert_match('RunTheTest', qflist[0].text)
3113+
call setqflist([], 'r')
3114+
au! InsertCharPre
3115+
3116+
" Check that lvimgrep without jumping can be executed.
3117+
au InsertCharPre * lvimgrep /RunTheTest/j runtest.vim
3118+
normal ax
3119+
let qflist = getloclist(0)
3120+
call assert_true(len(qflist) > 0)
3121+
call assert_match('RunTheTest', qflist[0].text)
3122+
call setloclist(0, [], 'r')
3123+
au! InsertCharPre
3124+
3125+
" Check that lvimgrepadd without jumping can be executed.
3126+
au InsertCharPre * lvimgrepadd /RunTheTest/j runtest.vim
3127+
normal ax
3128+
let qflist = getloclist(0)
3129+
call assert_true(len(qflist) > 0)
3130+
call assert_match('RunTheTest', qflist[0].text)
3131+
call setloclist(0, [], 'r')
3132+
au! InsertCharPre
3133+
3134+
" trying to jump will give an error
3135+
au InsertCharPre * vimgrep /RunTheTest/ runtest.vim
3136+
call assert_fails('normal ax', 'E565:')
3137+
au! InsertCharPre
3138+
3139+
au InsertCharPre * vimgrepadd /RunTheTest/ runtest.vim
3140+
call assert_fails('normal ax', 'E565:')
3141+
au! InsertCharPre
3142+
3143+
au InsertCharPre * lvimgrep /RunTheTest/ runtest.vim
3144+
call assert_fails('normal ax', 'E565:')
3145+
au! InsertCharPre
3146+
3147+
au InsertCharPre * lvimgrepadd /RunTheTest/ runtest.vim
3148+
call assert_fails('normal ax', 'E565:')
3149+
au! InsertCharPre
3150+
3151+
bwipe!
3152+
endfunc
3153+
30943154
" Tests for the quickfix buffer b:changedtick variable
30953155
func Xchangedtick_tests(cchar)
30963156
call s:setup_commands(a:cchar)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1984,
753755
/**/
754756
1983,
755757
/**/

0 commit comments

Comments
 (0)