annotate runtime/tools/vimspell.sh @ 17296:49ef396af986 v8.1.1647

patch 8.1.1647: build error with GTK and hangulinput feature commit https://github.com/vim/vim/commit/d84b2c3d88b08722dd4f686256a22c26788ea122 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 7 19:16:58 2019 +0200 patch 8.1.1647: build error with GTK and hangulinput feature Problem: Build error with GTK and hangulinput feature, im_get_status() defined twice. (Dominique Pelle) Solution: Adjust im_get_status(). (closes #4628)
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Jul 2019 19:30:05 +0200
parents f4f8014d516e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 #!/bin/sh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 # Spell a file & generate the syntax statements necessary to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 # highlight in vim. Based on a program from Krishna Gadepalli
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 # <krishna@stdavids.picker.com>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 # I use the following mappings (in .vimrc):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 # noremap <F8> :so `vimspell.sh %`<CR><CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 # noremap <F7> :syntax clear SpellErrors<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 # Neil Schemenauer <nascheme@ucalgary.ca>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 # March 1999
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 158
diff changeset
14 # updated 2008 Jul 17 by Bram
158
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
15 #
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
16 # Safe method for the temp file by Javier Fernández-Sanguino_Peña
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 INFILE=$1
158
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
19 tmp="${TMPDIR-/tmp}"
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
20 OUTFILE=`mktemp -t vimspellXXXXXX || tempfile -p vimspell || echo none`
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
21 # If the standard commands failed then create the file
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
22 # since we cannot create a directory (we cannot remove it on exit)
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
23 # create a file in the safest way possible.
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
24 if test "$OUTFILE" = none; then
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
25 OUTFILE=$tmp/vimspell$$
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 158
diff changeset
26 [ -e $OUTFILE ] && { echo "Cannot use temporary file $OUTFILE, it already exists!"; exit 1 ; }
158
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
27 (umask 077; touch $OUTFILE)
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
28 fi
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
29 # Note the copy of vimspell cannot be deleted on exit since it is
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
30 # used by vim, otherwise it should do this:
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
31 # trap "rm -f $OUTFILE" 0 1 2 3 9 11 13 15
78423945b251 updated for version 7.0048
vimboss
parents: 7
diff changeset
32
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 # local spellings
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 LOCAL_DICT=${LOCAL_DICT-$HOME/local/lib/local_dict}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if [ -f $LOCAL_DICT ]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 SPELL_ARGS="+$LOCAL_DICT"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 spell $SPELL_ARGS $INFILE | sort -u |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 awk '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 printf "syntax match SpellErrors \"\\<%s\\>\"\n", $0 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 END {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 printf "highlight link SpellErrors ErrorMsg\n\n" ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 ' > $OUTFILE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 echo "!rm $OUTFILE" >> $OUTFILE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 echo $OUTFILE