I know that I can suspend vim, and return to bash via:
Ctrlz
or access the shell via:
:sh
or
:shell
etc.
Then use bash commands as normal, and get back out using fg
.
What I am wondering is, can I execute a line of code from a script in vim straight to Bash, without having to exit vim, or having to copy it (via highlighting in visual mode for example) from vim, then going to a terminal and pasting it and hitting enter etc.?
Easiest way is to put the cursor on the line and type:
!!sh
return
This will replace the line with the output of the script. If you don't want that, simply follow up with u
.