Permalink
Browse files

dictfile: 读取文件失败时的处理

  • Loading branch information...
1 parent 9243bbd commit 5d0037227cd7bf4fb69db47a13cd34082f4dd222 @lilydjwg committed Jan 21, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 plugin/dictfile.vim
View
@@ -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

0 comments on commit 5d00372

Please sign in to comment.