I want to run a shell script inside a Vim editor. I heard that itβs possible, but I donβt know.
Command: ./shell.sh inside vim .
./shell.sh
vim
There are several ways to do this. The main question: "Do you want to get the result from the script in the file?"
If you want to get the result in a file:
:r!./shell.sh
If you do not want the output in the file:
:!./shell.sh
If the file contains the line ./shell.sh , you can include the output in the file with:
!!sh
If you have done this before, you have more options.
If you saved the command in a named buffer, you have a few more options.
If you want the script to have part of the file (edit buffer) as standard input, you have a huge number of options that you can use in conjunction with any of these mechanisms.
Command prefix with ! . For example, open Vim and write:
!
:!ls
This will execute the ls .
ls
Note that you will need to be in the correct directory in Vim for this to work.