vim - How to setup a file pattern for autocmd to not match the command line buffer? -
i have au command check if file had been changed:
autocmd cursorhold * checktime
but when launch command line window q:
or q/
following error:
error detected while processing cursorhold auto commands "*": e11: invalid in command-line window; <cr> executes, ctrl-c quits: checktime press enter or type command continue
my question is, possible set autocmd's pattern exclude command line buffers , other readonly buffers?
the easiest fix silence errors:
autocmd cursorhold * silent! checktime
alternatively, wrap in try
...catch /:e11:/
. or, attempt check command-line window:
autocmd cursorhold * if expand('%') !=# '[command line]' | checktime | endif
Comments
Post a Comment