Vim command history

I have been using Vim for a long while but didn’t realized that it has command history which records previously executed commands. I use to write the same/similar command every time I had to execute the command(yaa, I know it was kindda lame). This command history really comes handy if you are executing long command and want to execute the similar or same command.


Type ":" and you can press UP and DOWN button to navigate. To make this faster you can type ":" and first letter of your command and then press UP or DOWN button, in this way you don’t have to iteratively scan entire history until you find your command instead it jumps directly to the command.
Make sure you use this command :set history=1000 to set the bigger history limit so that it can memorize more commands.
Let me give you some CLI history command as well. If you want to see the command history just type history. Best command is CTRL+R and then type the initial characters of command. The command will automatically appear, you can navigate using arrow keys and then hit enter to execute the command. Even you can use "!" also known as “Bang!” command. If you execute "!!" it will execute the last command. You can also use "!" and initial characters of the command to execute it. One more trick when you type history command it list out the command with some number. I think, it is history entry number. If you want to execute that command run "!History-Entry-Number" e.g "!234".


no comment untill now

Add your comment now