summaryrefslogtreecommitdiffstats
path: root/runtime/spell/fixdup
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-08-21 22:12:59 +0000
committerBram Moolenaar <Bram@vim.org>2005-08-21 22:12:59 +0000
commitcee5560a4b3e40792f29b483e5d980403c99ffa6 (patch)
treee73e22890c2e1a032705f3f1c2ca47c2c19095aa /runtime/spell/fixdup
parentd12a1326031d82c0292718731c1ecbdf086cf00c (diff)
updated for version 7.0133
Diffstat (limited to 'runtime/spell/fixdup')
-rw-r--r--runtime/spell/fixdup27
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/spell/fixdup b/runtime/spell/fixdup
new file mode 100644
index 0000000000..0dd532d5e6
--- /dev/null
+++ b/runtime/spell/fixdup
@@ -0,0 +1,27 @@
+" Vim script to fix duplicate words in a .dic file vim: set ft=vim:
+"
+" Usage: Edit the .dic file and source this script.
+
+let deleted = 0
+
+" Start below the word count.
+let lnum = 2
+while lnum <= line('$')
+ let word = getline(lnum)
+ if word !~ '/'
+ if search('^' . word . '/', 'w') != 0
+ let deleted += 1
+ exe lnum . "d"
+ continue " don't increment lnum, it's already at the next word
+ endif
+ endif
+ let lnum += 1
+endwhile
+
+if deleted == 0
+ echomsg "No duplicate words found"
+elseif deleted == 1
+ echomsg "Deleted 1 duplicate word"
+else
+ echomsg printf("Deleted %d duplicate words", deleted)
+endif