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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -