From: Oleg Broytman Date: Thu, 24 Jul 2014 14:30:36 +0000 (+0400) Subject: Minor refactoring X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=62fec4fab94d6bb4fee1a31a9d941ad77b4f7f35;p=dotfiles.git Minor refactoring --- 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