luk400 / vim-jukit

Jupyter-Notebook inspired Neovim/Vim Plugin
MIT License
587 stars 23 forks source link

Unable to create output split with spaces in the file path - issue similar to #80 #102

Open marcusfschmidt opened 12 months ago

marcusfschmidt commented 12 months ago

I am trying to set jukit up on Windows (for now), and I am experiencing an issue related to the folder name I am trying to run from. I have some files located on my university OneDrive, which contains spaces in the folder name. When trying to make an output split for a file located in this folder, I get an error message of the form:

\\University<JUKIT_WS_PH>-<JUKIT_WS_PH>OneDrive\\pythonfile.py 2 --max_size=20\");"
The system cannot find the file specified.

Doing the same with a file not located in a folder with spaces in its name works fine and does not yield any errors - but if there are spaces in the path of the python file, it seems to break.

This seems similar to the issue raised in #80.

marcusfschmidt commented 12 months ago

By substituting both spaces and "-" with a string comprised of (XX) rather than < and >, I can circumvent the issue. I.e. in splits.vim:

        let pyfile_ws_sub =  escape(expand('%'), '\')
        let pyfile_ws_sub = substitute(pyfile_ws_sub, ' ', '(SP)', 'g')
        let pyfile_ws_sub = substitute(pyfile_ws_sub, '-', '(HY)', 'g')

... and subsequently in jukit_run.py:

        py_file = args.py_file.replace("(SP)", " ")
        py_file = py_file.replace("(HY)", "-")

... then it works. The command fails for me if the placeholders are made with <>. Time will tell if I have broken anything with this.