You seem to be under the impression that "exec" is used to execute external shell commands, but that's not the case.
The :execute
command is simply used to run a Vimscript from a string, and this is used in this case to assemble a shell command-line from a string, to include arguments for the contents of the current line and also the path to the figures/
directory.
Then this is being passed to a :.!
command, which runs the external command on a shell, passing the current line through the standard input, and then replacing the current line with the output produced by the external command. (See :help :range!
, where .
is being used as a range for the current line.)
However, I want to include the inkscape-figures watch
command to be executed when I press CTRL+F in insert mode.
You can similarly use that as a filter, or use the :r!
command to simply read the output of the external command, without any input, and pasting it below the current line.
For example:
:r!inkscape-figures watch
If that's what you want, you can map that to the Ctrl-F combination in insert mode using:
inoremap <C-f> <Esc>:r!inkscape-figures watch<CR>o
It seems you actually want to execute both commands with the Ctrl-F keypress. You can surely do that, either use the two commands in sequence with <CR>
in between them, or execute both commands in a single shell separating them with ;
or perhaps &&
(i.e. anything you can do on a shell.)
We'd need more details about what exactly you want to be able to give you a more detailed and complete answer, but hopefully this addresses your point about "exec" and gives you enough pointers to be able to come up with a useful mapping on your own.
:help :execute
and:help :map
? – D. Ben Knoble♦ Sep 16 '19 at 12:12