cmdline: CmdlineEnter and CmdlineLeave autocommands (#7422)

vim-patch:fafcf0dd59fd

patch 8.0.1206: no autocmd for entering or leaving the command line

Problem:    No autocmd for entering or leaving the command line.
Solution:   Add CmdlineEnter and CmdlineLeave.

fafcf0dd59
This commit is contained in:
Björn Linse
2017-11-22 22:35:20 +01:00
committed by GitHub
parent 9393be477a
commit a4f6cec7a3
10 changed files with 256 additions and 5 deletions

View File

@@ -420,3 +420,25 @@ function Test_autocmd_bufwipe_in_SessLoadPost2()
call delete(file)
endfor
endfunc
func Test_Cmdline()
au! CmdlineEnter : let g:entered = expand('<afile>')
au! CmdlineLeave : let g:left = expand('<afile>')
let g:entered = 0
let g:left = 0
call feedkeys(":echo 'hello'\<CR>", 'xt')
call assert_equal(':', g:entered)
call assert_equal(':', g:left)
au! CmdlineEnter
au! CmdlineLeave
au! CmdlineEnter / let g:entered = expand('<afile>')
au! CmdlineLeave / let g:left = expand('<afile>')
let g:entered = 0
let g:left = 0
call feedkeys("/hello<CR>", 'xt')
call assert_equal('/', g:entered)
call assert_equal('/', g:left)
au! CmdlineEnter
au! CmdlineLeave
endfunc