X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.vimrc;h=39ca62d8bace29996bcb3dfe95aab026ab8658be;hb=5f5dda45d35697bcc169ba8383e98ee9e5c3d8b3;hp=8e8884172805f4014f01f25446dc241e559543b5;hpb=096bb648471cb26e48e5c59911f52b6e436464a3;p=dotfiles.git diff --git a/.vimrc b/.vimrc index 8e88841..39ca62d 100644 --- a/.vimrc +++ b/.vimrc @@ -386,13 +386,13 @@ autocmd BufReadPost * call RestorePosition() 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 @@ -458,7 +458,7 @@ function! ExtractURL() let line = getline('.') let parts = split(line, s:URL_re . '\zs') - if len(parts) == 0 + if empty(parts) throw 'ExtractURLCannotFindURL' " No URL found endif @@ -781,7 +781,7 @@ if has("spell") autocmd BufReadPost * call SetupSpell() function! SaveSpell() - if expand('%') == expand('~/.vim/spell/en.ascii.add') + if expand('%:p') == expand('~/.vim/spell/en.ascii.add') mkspell! -ascii % else mkspell! %