Skip to content

Commit

Permalink
dictfile: 读取文件失败时的处理
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Jan 21, 2011
1 parent 9243bbd commit 5d00372
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugin/dictfile.vim
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ endfunction
function s:AddCurrent(file)
let name = g:dictfilePrefix . a:file
let word = expand("<cword>")
let f = readfile(name)
try
let f = readfile(name)
catch /^Vim\%((\a\+)\)\=:E484/
let f = []
endtry
let f = add(f, word)
call writefile(f, name)
echon word . " has been added to " . a:file
Expand Down

0 comments on commit 5d00372

Please sign in to comment.