Skip to content

Commit 3dcc256

Browse files
committed
UseConfigFiles: when verbose, report the reason for skipping a buffer
- Rather than just skipping the buffer, say why it was skipped if g:EditorConfig_verbose is truthy. - Don't print the "Applying EditorConfig" message until we're sure we won't be skipping this buffer.
1 parent 7f4e4df commit 3dcc256

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

plugin/editorconfig.vim

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,16 @@ function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
219219
if g:EditorConfig_enable_for_new_buf
220220
let l:buffer_name = getcwd() . "/."
221221
else
222+
if g:EditorConfig_verbose
223+
echo 'Skipping EditorConfig for unnamed buffer'
224+
endif
222225
return
223226
endif
224227
endif
225228

226229
if exists("b:EditorConfig_disable") && b:EditorConfig_disable
227230
if g:EditorConfig_verbose
228-
echo 'Skipping EditorConfig for buffer "' . l:buffer_name . '"'
231+
echo 'EditorConfig disabled --- skipping buffer "' . l:buffer_name . '"'
229232
endif
230233
return
231234
endif
@@ -249,18 +252,22 @@ function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
249252
endif
250253
endif
251254

252-
if g:EditorConfig_verbose
253-
echo 'Applying EditorConfig ' . s:editorconfig_core_mode .
254-
\ ' on file "' . l:buffer_name . '"'
255-
endif
256-
257255
" Ignore specific patterns
258256
for pattern in g:EditorConfig_exclude_patterns
259257
if l:buffer_name =~ pattern
258+
if g:EditorConfig_verbose
259+
echo 'Skipping EditorConfig for buffer "' . l:buffer_name .
260+
\ '" based on pattern "' . pattern . '"'
261+
endif
260262
return
261263
endif
262264
endfor
263265

266+
if g:EditorConfig_verbose
267+
echo 'Applying EditorConfig ' . s:editorconfig_core_mode .
268+
\ ' on file "' . l:buffer_name . '"'
269+
endif
270+
264271
if s:editorconfig_core_mode ==? 'vim_core'
265272
if s:UseConfigFiles_VimCore(l:buffer_name) == 0
266273
let b:editorconfig_applied = 1

0 commit comments

Comments
 (0)