mhinz / vim-startify

:link: The fancy start screen for Vim.
MIT License
5.3k stars 186 forks source link

Windows: `startify_change_to_dir` not applied if filename has spaces #507

Open rogino opened 2 years ago

rogino commented 2 years ago

On Windows, if the filename has spaces, Startify fails to change the directory.

Somewhere along the line, a:path, the path to the file that was selected, gets its spaces escaped with backslashes and this seems to be the cause of the issue.

On line 973 of autoload/startify, it calls fnamemodify(a:path, ':h') but only escapes up to the last space of the filename (e.g. C:\Users\rioog\folder\file\ with\ spaces becomes C:\Users\rioog\folder\file\ with). As this is not a valid directory name, it does not change the directory.

I haven't been able to track down where this improper escaping takes place so for now I've just changed that line to fnamemodify(expand('%'), ':h').

LamprosPitsillos commented 2 years ago

Can confirm that this is not just a windows issue. Running Artix linux and the latest Nvim git .