From 156dbcd738fbf997bfc996760d1f979a4496c746 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 23 Mar 2021 19:35:47 -0400 Subject: [PATCH] Don't set foldmethod=syntax in historical buffers This was originally implemented in part to address the marker fold method triggering on diffs, so try to still solve that. --- autoload/fugitive.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 1fd2f43..aac79c6 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2180,6 +2180,9 @@ function! fugitive#BufReadCmd(...) abort setlocal endofline try + if &foldmethod ==# 'marker' && b:fugitive_type !=# 'blob' + setlocal foldmethod=manual + endif silent exe s:DoAutocmd('BufReadPre') if b:fugitive_type ==# 'tree' let b:fugitive_display_format = b:fugitive_display_format % 2 @@ -2233,7 +2236,7 @@ function! fugitive#BufReadCmd(...) abort endif let &l:modifiable = modifiable if b:fugitive_type !=# 'blob' - setlocal filetype=git foldmethod=syntax + setlocal filetype=git call s:Map('n', 'a', ":let b:fugitive_display_format += v:count1exe fugitive#BufReadCmd(@%)", '') call s:Map('n', 'i', ":let b:fugitive_display_format -= v:count1exe fugitive#BufReadCmd(@%)", '') endif