Vim – map last shell command to the key

keyboard shortcutsvim

Is there any way to map leader-r to repeat last command sent to bash?

For example, when working with C files I would like to compile and run program from vim without typing :!make or gcc.

I know I can bind specific command to the key but it won't work for other types of files.

Best Answer

The :!! command repeats the last :!{cmd}. It's even available in venerable ol' vi.

Related Question