My question is about mapping a multi-part command to a single key combo.
In my .vimrc, I've got the following line:
nnoremap <leader>ss :w\|:silent !execute_external_script > output_of_script.txt\|:redraw!<cr>
As you can see, I've got three commands I want to execute when i press <leader>ss
. First, write the file, then execute my external script (the script runs a unit test). Unfortunately, my terminal doesn't redraw Vim after executing the shell command. So I tried appending that :redraw!
command, apparently that command is getting passed to the shell, not to Vim, because I'm getting this error:
bash: :redrawecho: command not found
.
How do I write the command so that the script executes in the shell, then redraw executes in Vim? (Also, as a bonus, could anyone explain what <cr>
does?)