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.

| improve this answer | |
  • Thanks for your answer, that also helps! However I'm looking for something that copies only the last typed characters up to a whitespace, not the entire phrase. I added another example to clarify my question. Thanks again for taking the time to reply. – Guilherme Salomé Nov 23 '15 at 15:30
  • @GuilhermeSalomé Then replace ^ with 'T ' is ok. – jiegec Nov 23 '15 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.