Skip to content

Instantly share code, notes, and snippets.

@thinca
Created December 14, 2010 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinca/740620 to your computer and use it in GitHub Desktop.
Save thinca/740620 to your computer and use it in GitHub Desktop.
" Emergency measures {{{3
command! -bar EskkFixDict call s:eskk_fix_dict(<q-args>)
function! s:eskk_fix_dict(file) " {{{
let file = a:file != '' ? a:file :
\ exists('g:eskk#dictionary.path') ? g:eskk#dictionary.path : ''
let file = expand(file)
if !filereadable(file)
return
endif
let dup = {}
let ari = []
let nasi = []
for line in readfile(file)
if has_key(dup, line)
continue
endif
let dup[line] = 1
if line =~ '^\s*;'
elseif line =~ '^\S\+\w '
call add(ari, line)
elseif line =~ '^\S\+\W '
call add(nasi, line)
endif
endfor
call writefile([';; okuri-ari entries.'] + ari +
\ [';; okuri-nasi entries.'] + nasi, file)
endfunction " }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment