

Vim's 'single-repeat' dot command
source link: https://tpaschalis.github.io/vim-repeat-command/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Vim's 'single-repeat' dot command
Okay, so first things first, let me get this off my chest.
Vim, I’ve been cheating on you. I know that I’ve said you’re all the IDE I could ask for and that you were there for me when I was with a 2GB-of-ram-craptop, when I was writing LaTeX or when I logged in that 20+ year old server.
But here’s one of the many reasons why I’m never giving up on you.
The ‘repeat’ command
When in Normal mode, you can command vim to ‘repeat’ the last change with the .
key.
That’s all you have to know to start using it, but you can always consult the manpages by :help single-repeat
.
The simplest of examples : say that you copy a line with yy
. Move to some other place and paste with p
. Move to another place, and repeat your last command (the paste) with .
. Or use 5.
to paste it 5 times.
Or you want to indent and initialize some struct values as ints. That would be i<tab>int
and then j^.j^.
to get to the start of the next line and repeat the command for these lines as well.
Or you want to change a word for substitutions, you can cw<new-word>
and then move around and change similar words using the dot.
Limitations
Unfortunately, the dot command does not repeat Normal sequences such as moving around or replaces. That means that you can’t easily avoid sequences like the j.j.
above. This is solvable by recording and using a macro :help recording
.
Also, to repeat an Ex command, use ` @:` for the same effect
Until next time!
Recommend
-
26
Different Ways To Repeat Your Last Command In LinuxToday, I will be teaching you how to repeat your last command in Linux. You don't have to re-type the previously executed commands in your Shell. Of...
-
17
Vim bash-completion This repository contains a bash-completion file for vim. The following features are curently supported: auto completion of remote files (vim scp://$host//files) basic argum...
-
8
Introduction Learn how to use Vi mode on the command line in Bash. Vim lovers rejoice. Did you know you can use Vim mode on the command line? After I found out you could enable Vim mode in bas...
-
14
Is there a command in Vim / Vi to move the cursor to the end of a highlight search? advertisements Are there any commands in Vim/Vi to move wi...
-
11
My VIM dir This is my personal .vim directory. Install cd ~ git clone --recursive https://github.com/mireq/dot-vim.git .vim ln -s ~/.vim/vimrc ~/.vimrc cd .vim mkdir backup mkdir spell mkdir tmp mkdir und...
-
3
Install WSL with a single command now available in Windows 10 version 2004 and higher
-
8
Files Permalink Latest commit message Commit time
-
9
星期一, 十一月 02, 2020 VIM学习笔记 全局命令(Global Command) :global全局命令,通常简写为:g,可以...
-
7
vim E492 Not an editor command Plugin xxxxvim E492 N_ 2017年3月21日 晚上 187 字 1 分钟最近自用的 vim 装了不少插件,但是发现 kubectl edit 或者
-
14
Understanding the Vim. Repeat Function
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK