jaxbot / browserlink.vim

Live browser editing for Vim
MIT License
711 stars 38 forks source link

Escape special characters in pathnames #33

Closed korsveien closed 9 years ago

korsveien commented 9 years ago

If the path included special characters such as white space, the shell would return with an error message stating that cd received too many arguments. Also, an extra ':h' is added to the expand call in order to avoid having to resort to '..' in the middle of the pathname.

jaxbot commented 9 years ago

Why the switch from system() to execute? Mostly concerned that this would change the cwd of the user's environment

jaxbot commented 9 years ago

Well, tested it out, seems to be working fine. Thanks for the patch! Still curious about the rationale, though. Probably something I don't know about Vim ;)

korsveien commented 9 years ago

I can't give you a rationale because I more or less have none. I don't know much about vimscript, so this was basically the result after som googling. :-P

However I looked it up and it seems 'execute' simply performs an Ex-command with the string you provide it as a parameter. Apparently this is a common way of performing external commands in vimscript. It seems I could have just escaped the original string with shellescape() and keep using system(), but oh well. You learn something new everyday I guess.