Repeat last command in Emacs

Posted on April 26, 2020

Since I started using Emacs I am trying to find Emacs way of doing things that were very convenient to me when using Vim(which I still use by the way).

Dot command

If you have used Vim for long enough I am sure at some point you or another you would have found the ‘dot’ command very useful.

And initially when making the switch/learning Emacs I missed it. And the equivalent to ‘dot’ is

C-x z

Well it isn’t as powerful as ‘dot’ of vim in the sense that since vim uses modes. You can go into insert mode and type a line or two, and come to normal mode and press dot to repeat the line without having to type it all over again. But in Emacs it would just repeat the last character.

Pretty sure there is a way to achieve that behavior but I haven’t figured it out yet, since the dot works on doom emacs well (which is another alternative that I will be exploring sometime).