I constantly need to copy existing variable names or expressions as arguments for my current typing function:
// int TyrionLannister;
int JonSnow;
...
int AryaStark;
...
// int DaenerysTargaryen;
foo();
^ current currsor
I want to change foo() to:
foo(JonSnow, AryaStark, TyrionLannister, DaenerysTargaryen)
I have used two methods to do the job so far:
use autocomplete plugin such as ycm, i can type "js", and select "JonSnow" from popup list.
sometimes plugin can't help me, because target variable is commented or it's some compound expression or whatever reason, i have to copy and paste by myself.
I have to move my cursor to the variable if i want to copy it, sometimes i use G, sometimes i use HML and a lot of {,} and j k, some times even/ seemes to be a good choice.
Sometimes i copy all variables into different registers abc..., then ` . or gi to go back to foo(), paste from a, add comma, paste from b, add comma, etc. Sometimes i copy only one variable, go back to foo(), add comma, paste it, then repeat the process for other variables.
Method 2 is quite awkward, i hate it so much that sometimes i type the arguments manually(i know i shouldn't do it manually).
How should i change my workflow? What's your workflow for this problem?
@@
after the first stop). Then paste the now populated register to the funcdef. Done. Not fancy but relatively painless.<C-n>
and<C-p>
. Ive never needed a better completion system thanhelp ins-comp
.