Bookmarked directory with a space in the name
- Dominant language
- Vim Script
- Stars
- 5.4k
- Forks
- 181
- PR merge metrics
- No merged PRs in 30d
Description
This may be the result of a bug in vim and neovim, but it appears that passing an escaped directory path to `isdirectory` results in a false negative. This prevents a bookmark such as `/Path/To Directory` from changing directories, though it will still open the directory in netrw.
I've done the following debugging:
```
let dir='/path/with space'
echo isdirectory(dir) => 1
echo isdirectory(fnameescape(dir)) => 0
```
This effects `startify` because the escaped path is passed into `s:check_user_options(path)` and the checks for `isdirectory` there prevent it from ever attempting to change directory.
Inconsistently, `execute 'lcd' dir` or `execute 'lcd' fnameescape(dir)` both work just fine. It only appears to be an issue with passing as a parameter. I also don't see a method for unescaping the path. I thought about using substitution, but that would break for Windows paths.
Not sure if there's another work around here besides renaming my directories.
Contributor guide
Research direction
Start by tracing the bookmark path through s:check_user_options(path), focusing on how the escaped directory is passed to isdirectory. Reproduce the issue with a bookmarked path containing spaces in Vim or Neovim, and consider Windows paths while checking the existing directory-change behavior. Done means such bookmarks pass validation and change directories without breaking existing paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vim
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100