hanschen / vim-ipython-cell

Seamlessly run Python code in IPython from Vim
GNU General Public License v3.0
331 stars 18 forks source link

Enclose filepath in single quotes for paths with spaces #18

Closed tuna-f1sh closed 3 years ago

tuna-f1sh commented 3 years ago

I encountered an issue with IPythonCellRun where a path with spaces in is not escaped or enclosed, leading to the REPL attempting to run an invalid path - the first space break.

Although I try to avoid paths with spaces in, Dropbox Business/Personal insists in separating the names with a space.

This pull request simply encloses the vim buffer name and tells Python it's a raw string. Fixes the problem and I think is non-breaking.

hanschen commented 3 years ago

Thanks for the pull request. I solve it in a slightly different way by simply including the "" in the default g:ipython_cell_run_command option.

Please report back if you encounter any issues with this change.

tuna-f1sh commented 3 years ago

Yes this works too. Happy for the solution either way.

Setting g:ipython_cell_run_command was actually my first port of call but wasn't sure how to enclose the setting since "" around filepath without the '' for the var didn't work. Went to the Python option since I don't really know vimscript. Now I see though so I've learnt something there!