Text this: A general theory of linear cosmological perturbations: scalar-tensor and vector-tensor theories