Is it possible to create an autocommand that executes whenever one of the files in the arglist is written to?
There is not a specific Autocommand event for writes to the arglist files. What you can do is create a function that checks if the file is in the arglist and then set that to the
BufWrite event. So all buffer writes would trigger this function, but only arglist'd files would actually do anything.
You can use
bufname("%") to find the current buffer's name, and then use
argc() to find the arglist entries.
function! IsBufInArgs() let c = 0 while c <= argc() if argv(c) == bufname("%") return 1 endif let c += 1 endwhile return 0 endfunction function! DoOnlyWithArg() if IsBufInArgs() == 1 echo "Do something here" endif endfunction autocmd BufWrite * :call DoOnlyWithArg()