Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to open vim and see my ":" commands from a previous session. Is that possible?

When i open a file in vim I usually press, by reflex, the colon to see a list of previous commands, but its empty. How can I get my previous command history.

like image 459
Chris Reid Avatar asked Jul 22 '12 18:07

Chris Reid


People also ask

How do I find previous commands in Vim?

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.

Does vim do previous commands?

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.

How do I go back to previous position in Vim?

Vim makes it easy to navigate previous locations: Ctrl + o navigate to the previous location in the jump list (think o as old) Ctrl + i navigate to the next location in the jump list ( i and o are usually next to each other) g; go to the previous change location.

How do I go to previous in vi?

Press <shift-N> to go back to the previous occurrence of your find term.


2 Answers

:history should do what you want.

like image 71
chaos Avatar answered Sep 19 '22 14:09

chaos


q: would be better. it will display a list of commands, and you can press jorkfor motion,thenenter to run a selected one.

like image 24
UncleBill Avatar answered Sep 18 '22 14:09

UncleBill