Vim How to debug shell scripts that are currently being edited in the same window

Asked 1 months ago, Updated 1 months ago, 5 views

environment
Windows 10 pro WSL Ubuntu 20.04 LTS
Vim 8.1

What do you want to do
I would like to know if there is a way to debug the shell script that Vim is currently editing.

As an example, I usually use the following methods to verify the behavior of my scripts:

In pane "1", teratail.sh is being edited as shown in the picture below.
The pane 」2 は is for checking your script.

Enter a description of the image here
However, I have to move the pane to try it, so
I think it's a bit troublesome.

So the ideal is...
1. Execute (debug) commands in the edit window
US>2. The window is split.
3. The shell file being edited is executed in the split window

Can't we do it in that way?I am thinking that

Commandally speaking, the terminal command splits the screen of the Vim, but
I'd like to give you the file you're editing and have it run.

Enter a description of the image here

For those who know how to do it
If there is a way, please let me know.
I would appreciate it if you could let me know if my way of thinking is different.

linux ubuntu vim wsl

2022-09-30 11:45

1 Answers

:terminal can specify commands to execute with arguments.If unspecified, the $SHELL is used, so the shell usually comes up.
In other words, you can run the current buffer by passing it to bash, where % is replaced by the name of the current buffer.

:terminal bash%


2022-09-30 11:45

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.