From 9545f0cfcfc356a7a30f38f55c39cd5caaf27d51 Mon Sep 17 00:00:00 2001 From: Fredrik Hansson Date: Sat, 8 Aug 2015 14:01:26 +0200 Subject: [PATCH 1/2] fix for using the default gg=G on files without formatting definitions at all --- plugin/autoformat.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/autoformat.vim b/plugin/autoformat.vim index 0d2f18d..79bc9c6 100644 --- a/plugin/autoformat.vim +++ b/plugin/autoformat.vim @@ -60,6 +60,7 @@ endfunction function! s:TryAllFormatters(...) range " Make sure formatters are defined and detected if !call('find_formatters', a:000) + exe "normal gg=G" return 0 endif @@ -106,6 +107,7 @@ function! s:TryAllFormatters(...) range if s:index == b:current_formatter_index " Tried all formatters, none worked + exe "normal gg=G" return 0 endif endwhile From 0ea8377eaa84b487e95539e965bf0658d7fdb6ac Mon Sep 17 00:00:00 2001 From: Chiel92 Date: Sat, 8 Aug 2015 14:37:21 +0200 Subject: [PATCH 2/2] Cleanup --- plugin/autoformat.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugin/autoformat.vim b/plugin/autoformat.vim index 79bc9c6..282e2c2 100644 --- a/plugin/autoformat.vim +++ b/plugin/autoformat.vim @@ -60,6 +60,7 @@ endfunction function! s:TryAllFormatters(...) range " Make sure formatters are defined and detected if !call('find_formatters', a:000) + " No formatters defined, so autoindent code exe "normal gg=G" return 0 endif @@ -106,16 +107,12 @@ function! s:TryAllFormatters(...) range endif if s:index == b:current_formatter_index - " Tried all formatters, none worked + " Tried all formatters, none worked so autoindent code exe "normal gg=G" return 0 endif endwhile - - " Autoindent code if no formatters work - exe "normal gg=G" - endfunction