Skip to content

Commit 3c2813f

Browse files
authored
fix: E495 on VimEnter with 'verbose' (#242)
Problem: If 'verbose' is non-zero, VimEnter autocmd when starting vim without args raises E495: Error detected while processing VimEnter Autocommands for "*"..function <SNR>37_UseConfigFiles: line 6: E495: No autocommand file name to substitute for "<afile>" Solution: Replace "<afile>" with "#n" (:help :_#n).
1 parent ba2ce02 commit 3c2813f

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

plugin/editorconfig.vim

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,9 @@ function! s:UseConfigFiles(from_autocmd) abort " Apply config to the current buf
209209
" from_autocmd is truthy if called from an autocmd, falsy otherwise.
210210

211211
" Get the properties of the buffer we are working on
212-
if a:from_autocmd
213-
let l:bufnr = str2nr(expand('<abuf>'))
214-
let l:buffer_name = expand('<afile>:p')
215-
let l:buffer_path = expand('<afile>:p:h')
216-
else
217-
let l:bufnr = bufnr('%')
218-
let l:buffer_name = expand('%:p')
219-
let l:buffer_path = expand('%:p:h')
220-
endif
212+
let l:bufnr = a:from_autocmd ? str2nr(expand('<abuf>')) : bufnr('%')
213+
let l:buffer_name = expand('#'.l:bufnr.':p')
214+
let l:buffer_path = expand('#'.l:bufnr.':p:h')
221215
call setbufvar(l:bufnr, 'editorconfig_tried', 1)
222216

223217
" Only process normal buffers (do not treat help files as '.txt' files)

0 commit comments

Comments
 (0)