I know that in vim I can type
:terminal <command> %
to run a command on the file in the current edit buffer. For example and to simplify what I want to do let's take a simple ls command:
:terminal ls %
which will split the window, run the command and exit the shell while leaving the output on the screen. that's not what I want. I want it to run the command but leave me in the shell so I can run more bash commands potentially related to the current file/operation, then exit manually when I'm done.
If I simply type
:terminal
it brings me to a bash shell which allows me to type as many commands as I want which is great. BUT I then lose the ability to use the expansion facility of %, and the ease of spawning the terminal from the file I'm editing. ie. I lose the automation of the context provided by spawning from the original file/buffer which means I have to manually type in the current file name including potentially long path and or scroll previous bash history to rerun the original command. this is a waste of keystrokes.
Basically, I'm trying to find a way to create a vim map that lets me use % filename expansion in a bash command via :term withOUT ending the job after the command is run (i prefer to be left in at a prompt in a shell to continue the session!)
I actually don't care if a solution just starts the :term shell and echos my command with % filename expansion at the bash prompt without entering it.. that would allow me to still stay in bash after the command is executed by me with a manual carriage return.
I'm not sure if what I want to do is possible? note, I'm not looking to suspend my current edit session and fg back as it ties up the current editing session. I'm not sure if tmux - vim integration might provide a way to do what I want though I'd prefer to find a solution using straight-up :term since it's a built-in feature and works well except for what I'm trying to achieve :)