annotate runtime/spell/fixdup.vim @ 14491:9df0fcbfebb2 v8.1.0259

patch 8.1.0259: no test for fixed quickfix issue commit https://github.com/vim/vim/commit/3f347e4716c44cf6458be407e712e3d708d82580 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 9 21:19:20 2018 +0200 patch 8.1.0259: no test for fixed quickfix issue Problem: No test for fixed quickfix issue. Solution: Add a test. Clean up the code a bit. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Thu, 09 Aug 2018 21:30:05 +0200
parents 7bc41231fbc7
children 7cfe57329284
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
1 " Vim script to fix duplicate words in a .dic file vim: set ft=vim:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
2 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
3 " Usage: Edit the .dic file and source this script.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
4
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
5 let deleted = 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
6
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
7 " Start below the word count.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
8 let lnum = 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
9 while lnum <= line('$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
10 let word = getline(lnum)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
11 if word !~ '/'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
12 if search('^' . word . '/', 'w') != 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
13 let deleted += 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
14 exe lnum . "d"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
15 continue " don't increment lnum, it's already at the next word
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
16 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
17 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
18 let lnum += 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
19 endwhile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
20
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
21 if deleted == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
22 echomsg "No duplicate words found"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
23 elseif deleted == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
24 echomsg "Deleted 1 duplicate word"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
25 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
26 echomsg printf("Deleted %d duplicate words", deleted)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
27 endif