" Try to recognize the file encoding and convert the file
let encoding = system("get_html_encoding.py " . shellescape(expand("%")))
if !v:shell_error
- if strlen(encoding) != 0
+ if !empty(encoding)
call SetupEncoding(encoding)
endif
endif
" Try to recognize the file encoding and convert the file
let encoding = system("get_xml_encoding.py " . shellescape(expand("%")))
if !v:shell_error
- if strlen(encoding) == 0
+ if empty(encoding)
" By default XML files are in UTF-8
let encoding = "UTF-8"
endif
function! SetupEncoding(encoding)
- if !has("iconv") || exists('b:encoding_set') || strlen(a:encoding) == 0
+ if !has("iconv") || exists('b:encoding_set') || empty(a:encoding)
return
endif
call RestorePosition()
let b:encoding_set = 1
- if len(expand('%'))
+ if !empty(expand('%'))
execute "edit ++enc=" . a:encoding
endif
endfunction
let line = getline('.')
let parts = split(line, s:URL_re . '\zs')
- if len(parts) == 0
+ if empty(parts)
throw 'ExtractURLCannotFindURL' " No URL found
endif