From dcc89f8c659050fe95f149845cb2abc7858e0259 Mon Sep 17 00:00:00 2001 From: "Ryan J. Dillon" Date: Sun, 2 Aug 2020 13:43:52 +0200 Subject: [PATCH 1/2] Add compact default to hide stdin/stdout --- autoload/neoformat.vim | 10 ++++++++-- autoload/neoformat/utils.vim | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/autoload/neoformat.vim b/autoload/neoformat.vim index 7891c83d..6b5cf844 100644 --- a/autoload/neoformat.vim +++ b/autoload/neoformat.vim @@ -78,7 +78,10 @@ function! s:neoformat(bang, user_input, start_line, end_line) abort let stdin = getbufline(bufnr('%'), a:start_line, a:end_line) let original_buffer = getbufline(bufnr('%'), 1, '$') - call neoformat#utils#log(stdin) + " include stdin in output only if specified + if !neoformat#utils#should_be_compact() + call neoformat#utils#log(stdin) + endif call neoformat#utils#log(cmd.exe) if cmd.stdin @@ -96,7 +99,10 @@ function! s:neoformat(bang, user_input, start_line, end_line) abort let stdout = readfile(cmd.tmp_file_path) endif - call neoformat#utils#log(stdout) + " include stdout in output only if specified + if !neoformat#utils#should_be_compact() + call neoformat#utils#log(stdout) + endif call neoformat#utils#log(cmd.valid_exit_codes) call neoformat#utils#log(v:shell_error) diff --git a/autoload/neoformat/utils.vim b/autoload/neoformat/utils.vim index 06fe933f..6b8e36dc 100644 --- a/autoload/neoformat/utils.vim +++ b/autoload/neoformat/utils.vim @@ -28,6 +28,13 @@ function! neoformat#utils#should_be_verbose() abort return &verbose || g:neoformat_verbose endfunction +function! neoformat#utils#should_be_compact() abort + if !exists('g:neoformat_compact') + let g:neoformat_compact = 1 + endif + return g:neoformat_compact +endfunction + function! s:better_echo(msg) abort if type(a:msg) != type('') echom 'Neoformat: ' . string(a:msg) From 2396023380b9fca4184f8302144b43c50b163817 Mon Sep 17 00:00:00 2001 From: "Ryan J. Dillon" Date: Sun, 2 Aug 2020 13:44:35 +0200 Subject: [PATCH 2/2] Remove whitespace --- autoload/neoformat.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/neoformat.vim b/autoload/neoformat.vim index 6b5cf844..9352233f 100644 --- a/autoload/neoformat.vim +++ b/autoload/neoformat.vim @@ -108,7 +108,7 @@ function! s:neoformat(bang, user_input, start_line, end_line) abort call neoformat#utils#log(v:shell_error) let process_ran_succesfully = index(cmd.valid_exit_codes, v:shell_error) != -1 - + if cmd.stderr_log != '' call neoformat#utils#log('stderr output redirected to file' . cmd.stderr_log) call neoformat#utils#log_file_content(cmd.stderr_log)