Is there a command which shows what was the last command in normal mode?
Suppose I accidently hit random key and got some unexpected result. Sure I can undo it, but could I reveal what key was pressed and how it was interpreted?
Press Ctrl+F in command mode to open the command history window. Then, you can use / , ? , and other search commands. Press Enter to execute a command from the history.
Vim text editor is capable of recording the history of all the commands that we enter on the command line prompt. There are two ways of recalling the command history: dialling up the command line window or scrolling through the past command lines using the cursor keys.
If you're already in vi, you can use the goto command. To do this, press Esc , type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file.
To get previous command containing string, hit [CTRL]+[r] followed by search string: (reverse-i-search): To get previous command, hit [CTRL]+[p]. You can also use up arrow key.
Hit the colon (:
) and then use the up arrow to start going back through previous commands. You can use the up/down arrows too to move around the list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With