# Repeat typed characters before a space

Using Emacs with Evil Mode, I wonder if there's a way to quickly re-enter all the characters that were typed before a whitespace character is entered.

Example: you type \hat{\beta}_{OLS,j} and then you add a whitespace , now you want to re-type \hat{\beta}_{OLS,j} automatically, so that in the end you have

\hat{\beta}_{OLS,j} \hat{\beta}_{OLS,j}

Example 2: you type foo foo complicated_formula and then enter a whitespace , now you want to retype complicated_formula automatically, so that in the end you obtain:

foo foo complicated_formula complicated_formula

How can I achieve this functionality? Is there something similar or better than this already available?

Thanks for helping me out! Keep in mind I'm extremely newb. Thanks again! :D

qayT pq creates a macro 'a' that copies the text from the previous space to the cursor and then paste it. You can write a function the do this as well. And i think this should be a vim-related question.