is0n/jaq-nvim

How to run python module

ok97465 opened this issue · 4 comments

Hello.
Thank you for your good plugin.

I tried to run the python code as a module as below.

python = "python3 -m $fileBase"

The result of the above command was "python3 -m scripts/ex1",
but the result I wanted was "python3 -m scripts.ex1".

Could you add a variable for python module?

thank you.

is0n commented

Could you open the python file you are trying to run and provide the output of...

:lua print(vim.fn.expand('%:r'))

Could you open the python file you are trying to run and provide the output of...

:lua print(vim.fn.expand('%:r'))

The output is "scripts/ex1". $fileBase (vim.fn.expand('%:r')) is working properly.

But it would be nice if there is an another variable for python module (ex. $moduleName).

The command I used to run the python module in vim is as follows.

python3 -m substitute(substitute(fnamemodify(expand("%:r"), ":~:."), "/", ".", "g"), "\\", ".", "g")
is0n commented

Could you check if the latest commit helps at all?

The new variable should be under the name $moduleName

It is working for me.
Thank you very much.