annotate runtime/spell/fixdup.vim @ 8657:c70eea7a7677 v7.4.1618

commit https://github.com/vim/vim/commit/a4f6ca717b4483eb82c6c71f71a5a5cf70e55d80 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 20 17:28:35 2016 +0100 patch 7.4.1618 Problem: Starting job with output to buffer changes options in the current buffer. Solution: Set "curbuf" earlier. (Yasuhiro Matsumoto)
author Christian Brabandt <cb@256bit.org>
date Sun, 20 Mar 2016 17:30:05 +0100
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