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

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -