mhinz / mhinz/vim-startify

Windows: `startify_change_to_dir` not applied if filename has spaces

Open
#507 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
5.4k
Forks
181
PR merge metrics
No merged PRs in 30d

Description

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')`.

Contributor guide

Open the contributing guide

Research direction

Start in autoload/startify around line 973 and inspect how startify_change_to_dir passes the selected a:path to fnamemodify. Reproduce the Windows case with a filename containing spaces and verify that the directory changes to the file's parent without truncating the path.

Written by the indexing model from the issue text.

Assessment

Tech stack
vim
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.