Move look-up out of loop.

This commit is contained in:
Andy Stewart
2018-03-14 14:40:06 +00:00
parent 3b2461b2fb
commit efd373d86d

View File

@@ -334,8 +334,9 @@ function! s:write_buffer(bufnr, file)
if getbufvar(a:bufnr, '&fileformat') ==# 'dos'
call map(bufcontents, 'v:val."\r"')
endif
if getbufvar(a:bufnr, '&fileencoding') !=# &encoding
call map(bufcontents, 'iconv(v:val, &encoding, getbufvar(a:bufnr, "&fileencoding"))')
let fenc = getbufvar(a:bufnr, '&fileencoding')
if fenc !=# &encoding
call map(bufcontents, 'iconv(v:val, &encoding, "'.fenc.'")')
endif
call writefile(bufcontents, a:file)
endfunction