I use the following insert-mode mapping to add an argument to a (C/C++) function with the same type as the previous argument:
define-command -hidden -override insert-last-arg-type %{
execute-keys -draft 'Z<a-f>,bh<a-?>[(,]<ret>Ls[^ ].*<ret>yzP'
}
map global insert <a-,> '<a-;>: insert-last-arg-type<ret>'
For example, If I type
void foo(const std::vector<int> &a,
and then press <a-,>
, I get:
void foo(const std::vector<int> &a, const std::vector<int> &