Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle prefixes from (git) diff #12

Closed
blueyed opened this issue Mar 17, 2016 · 2 comments
Closed

Handle prefixes from (git) diff #12

blueyed opened this issue Mar 17, 2016 · 2 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Mar 17, 2016

I've thought that we've talked about this before, but could not find it now.

I am using the following snippet to be able to open files from e.g. git-diff, where the prefix is ignored.
It seems to be a good fit for this plugin?!

" Check if the new file (with git-diff prefix removed) is readable and
" edit that instead (copy'n'paste from shell).
" (for git diff: `[abiw]`).
au BufNewFile * nested let s:fn = expand('<afile>') |
  \ echom filereadable(s:fn) |
  \ if ! filereadable(s:fn) |
  \   let s:fn = substitute(s:fn, '^\S/', '', '') |
  \   if filereadable(s:fn) |
  \     exec 'edit' s:fn |
  \     bdelete # |
  \     redraw |
  \     echomsg 'Got unreadable file, editing' s:fn 'instead.' |
  \   endif |
  \ endif
@kopischke
Copy link
Collaborator

Yes we did, actually, in #6 (I had to look for it too, the topic of the issue is a bit generic). I am still not sure if interpreting paths is not best left to &includeexpr and friends, but as I am currently reworking fetch to handle #9 and the refactoring needed for that has taken me 90 % of the way towards user configurable specs, I might go the last mile for the next release and open up the API.

@kopischke kopischke self-assigned this Mar 18, 2016
@kopischke
Copy link
Collaborator

Closing as duplicate, but stay tuned for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants