Patch to fix filename detection #216

Closed
phmarek opened this Issue Jun 28, 2012 · 2 comments

Projects

None yet

2 participants

@phmarek
phmarek commented Jun 28, 2012

I'm using diff.noprefix = true, and so the folding doesn't work.

diff --git plugin/fugitive.vim plugin/fugitive.vim
index a03cfb8..0149ac0 100644
--- plugin/fugitive.vim
+++ plugin/fugitive.vim
@@ -2426,8 +2426,8 @@ function! fugitive#foldtext() abort
     let [add, remove] = [-1, -1]
     let filename = ''
     for lnum in range(v:foldstart, v:foldend)
-      if filename ==# '' && getline(lnum) =~# '^[+-]\{3\} [ab]/'
-        let filename = getline(lnum)[6:-1]
+      if filename ==# '' && getline(lnum) =~# '^[+-]\{3\} '
+        let filename = getline(lnum)[4:-1]
       endif
       if getline(lnum) =~# '^+'
         let add += 1
Owner
tpope commented Jul 8, 2012

Hmm, I don't really want a/ to show up for everyone that doesn't have the option set. My first instinct is to force the prefix when editing a commit.

@tpope tpope added a commit that closed this issue Oct 22, 2012
@tpope Provide failsafe for foldtext filename
Closes #216.
9afeebf
@tpope tpope closed this in 9afeebf Oct 22, 2012
Owner
tpope commented Oct 22, 2012

I've made it so that it falls back to grabbing the entire diff line. Seems reasonable enough.

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