From 9955b8abbdf1a946a1f54201ae10fd3ba27c0660 Mon Sep 17 00:00:00 2001
From: Jerome Reybert <jreybert@gmail.com>
Date: Thu, 23 Feb 2017 22:16:16 +0100
Subject: [PATCH] plugin/magit.vim: <cr> toggle vim folding (ref #71)

---
 plugin/magit.vim | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plugin/magit.vim b/plugin/magit.vim
index 2523a0c..615864c 100644
--- a/plugin/magit.vim
+++ b/plugin/magit.vim
@@ -475,6 +475,12 @@ endfunction
 function! magit#open_close_folding_wrapper(mapping, ...)
 	if ( getline(".") =~ g:magit_file_re )
 		return call('magit#open_close_folding', a:000)
+	elseif ( foldlevel(line(".")) == 2 )
+		if ( foldclosed(line('.')) == -1 )
+			foldclose
+		else
+			foldopen
+		endif
 	else
 		silent! execute "silent! normal! " . a:mapping
 	endif
-- 
GitLab