I would like to make a function which does the following
if (vim is running in powershell)
call system("only works in powershell")
else
echo "Skipping powershell command"
Does anyone know how to tell what program vim is being run from?
EDIT: echo &term outputs “win32” in both cases.
From what I see you don’t need to check what vim was run from. You need to check the value of
&shellbecause vim will run command in powershell if&shelloption tells it to run command in powershell. If name of the shell isposhthen checking may be done with. But I would rather suggest to run powershell directly with something like
(note: I am not sure about what
'posh -c 'string should actually look like) or temporary set &shell option:(again, not sure about exact values of options): these ways command will always run in powershell.