Reputation: 19448
I am writing some map commands that run external commands. For example, I may have the following map command to compile the working project.
nnoremap <F5> :!mvn compile test<CR>
However, when vim switches to a shell, it's not clear what command is running. Is there a way for the command to show up on the shell, short of echoing it? It seems tedious to need to write the following each time, but it would do what I want.
nnoremap <F5> :!echo "mvn compile test"<CR>:!mvn compile test<CR>
Upvotes: 0
Views: 1001
Reputation: 3871
If your external command processor is a UNIX style shell, it has an echo feature, and you need only to pass the x option to it:
map <F5> :!sh -xc 'mvn compile test'<CR>
Upvotes: 2