tpope / vim-projectionist

projectionist.vim: Granular project configuration
https://www.vim.org/scripts/script.php?script_id=4989
1.06k stars 67 forks source link

:A doesn't support paths containing the `+` character #146

Closed jparise closed 4 years ago

jparise commented 4 years ago

Objective-C filenames can use the + character. (It's a common convention to name a class category file something like NSString+Additions.h, for example.) Objective-C buffers have isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=,@-@.

:A doesn't support these kinds of filenames. In s:jumpopt, this substitution happens:

  let pattern = '!$\|[:+@#]\d\+$\|[+@#].*$'
  let file = substitute(a:file, pattern, '', '')
  let jump = matchstr(a:file, pattern)

After the substitute, a filename like directory/NSString+Additions.h becomes just directory/NSString, because of the [+@#].*$ portion of the pattern.

Changing that sub-pattern to ^[+@#].*$ (match at start) "works for me", but I'm not confident enough in that change to submit it as a pull request because I don't fully understand this code's intentions.