From 62fec4fab94d6bb4fee1a31a9d941ad77b4f7f35 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 24 Jul 2014 18:30:36 +0400 Subject: [PATCH] Minor refactoring --- .vim/ftplugin/xml.vim | 2 +- .vimrc | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.vim/ftplugin/xml.vim b/.vim/ftplugin/xml.vim index 02d8ac6..9069c20 100644 --- a/.vim/ftplugin/xml.vim +++ b/.vim/ftplugin/xml.vim @@ -10,8 +10,8 @@ if version >= 702 && has("iconv") && !exists('b:encoding_set') " By default XML files are in UTF-8 let encoding = "UTF-8" endif + call SetupEncoding(encoding) endif - call SetupEncoding(encoding) endif setlocal matchpairs+=<:> " Add brokets to the list of pairs that match for the '%' command diff --git a/.vimrc b/.vimrc index 288fb49..eee8502 100644 --- a/.vimrc +++ b/.vimrc @@ -289,15 +289,13 @@ autocmd BufReadPost * call RestorePosition() function! SetupEncoding(encoding) - if !has("iconv") || exists('b:encoding_set') + if !has("iconv") || exists('b:encoding_set') || strlen(a:encoding) <= 0 return endif - if strlen(a:encoding) > 0 - call RestorePosition() - let b:encoding_set = 1 - execute "edit ++enc=" . a:encoding - endif + call RestorePosition() + let b:encoding_set = 1 + execute "edit ++enc=" . a:encoding endfunction -- 2.39.2