From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 9 Jan 2003 20:23:38 +0300 From: Alexey Tourbin To: community@altlinux.ru Message-ID: <20030109172338.GA17481@ungrund> Mail-Followup-To: community@altlinux.ru Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eAbsdosE1cNLO4uF" Content-Disposition: inline Subject: [Comm] .vimispell.vim Sender: community-admin@altlinux.ru Errors-To: community-admin@altlinux.ru X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.0.9 Precedence: bulk Reply-To: community@altlinux.ru List-Unsubscribe: , List-Id: List-Post: List-Help: List-Subscribe: , List-Archive: Archived-At: List-Archive: List-Post: --eAbsdosE1cNLO4uF Content-Type: multipart/mixed; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline Content-Transfer-Encoding: 8bit --J/dobhs11T7y2rNN Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit Может кому надо... или может у кого лучше есть? -- WBR, Alexey Tourbin BIOZAK Ltd., Russia --J/dobhs11T7y2rNN Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=".vimispell.vim" " Use ispell to highlight spellig errors " Author: Claudio Fleiner " Modified by Alexey Tourbin " F6 - write file, spell file & highlight spelling mistakes; " - switch between american russianw and spelling " - return to normal syntax coloring " I - insert word under cursor into directory " U - insert word under cursor as lowercase into directory " A - accept word for this session only " / - check for alternatives :function! ProposeAlternatives() : let @_=CheckSpellLanguage() : let alter=system("echo ".expand("")." | ispell -a -d ".b:language." | sed -e '/^$/d' -e '/^[@*#]/d' -e 's/.*: //' -e 's/,//g' | awk '{ for(i=1;i<=NF;i++) if(i<10) printf \"map %d :let r=SpellReplace(\\\"%s\\\") | echo \\\"%d: %s\\\" | \",i,$i,i,$i; }'") : if alter !=? "" : echo "Checking ".expand("").": Type 0 for no change, r to replace or" : exe alter : map 0 :let r=SpellRemoveMappings() : map r 0gewcw : else : echo "no alternatives" : endif :endfunction :function! SpellRemoveMappings() : let counter=0 : while counter<10 : exe "map ".counter." x" : exe "unmap ".counter : let counter=counter+1 : endwhile : unmap r :endfunction :function! SpellReplace(s) : exe "normal gewcw".a:s."\" : let r=SpellRemoveMappings() :endfunction :function! ExitSpell() : syntax on : unmap i : unmap u : unmap a : unmap n : unmap p : unmap : unmap : unmap : unmap : unmap : syn match SpellErrors "xxxxx" : syn match SpellCorrected "xxxxx" : syn clear SpellErrors : syn clear SpellCorrected :endfunction :function! SpellCheck() : syntax off : set wrap : syn case match : let @_=CheckSpellLanguage() : w : syn match SpellErrors "xxxxx" : syn clear SpellErrors : let b:spellerrors="\\<\\(nonexisitingwordinthisdociumnt" : let b:mappings=system("ispell -l -d ".b:language." < ".expand("%")." | sort -u | sed 's/\\(.*\\)/syntax match SpellErrors \"\\\\<\\1\\\\>\" ".b:spell_options."| let b:spellerrors=b:spellerrors.\"\\\\\\\\\\\\\\\\|\\1\"/'") : exe b:mappings : let b:spellerrors=b:spellerrors."\\)\\>" : map i :let @_=system("echo \\\*".expand("")." \| ispell -a -d ".b:language):syn case match:exe "syn match SpellCorrected \"\\<".expand("")."\\>\" transparent contains=NONE ".b:spell_options : map u :let @_=system("echo \\\&".expand("")." \| ispell -a -d ".b:language):syn case ignore:exe "syn match SpellCorrected \"\\<".expand("")."\\>\" transparent contains=NONE ".b:spell_options : map a :syn case match:exe "syn match SpellCorrected \"\\<".expand("")."\\>\" transparent contains=NONE ".b:spell_options : exe "map n /".b:spellerrors."\" : exe "map p ?".b:spellerrors."\" : map :let @_=system("echo \\\*".expand("")." \| ispell -a -d ".b:language):syn case match:exe "syn match SpellCorrected \"\\<".expand("")."\\>\" transparent contains=NONE ".b:spell_options : map :let @_=system("echo \\\&".expand("")." \| ispell -a -d ".b:language):syn case ignore:exe "syn match SpellCorrected \"\\<".expand("")."\\>\" transparent contains=NONE ".b:spell_options : map :syn case match:exe "syn match SpellCorrected \"\\<".expand("")."\\>\" transparent contains=NONE ".b:spell_options : exe "map /".b:spellerrors."\" : exe "map ?".b:spellerrors."\" : syn cluster Spell contains=SpellErrors,SpellCorrected : hi link SpellErrors Error : exe "normal \" :endfunction :function! CheckSpellLanguage() : if !exists("b:spell_options") : let b:spell_options="" : endif :endfunction :function! SpellLanguage() : if !exists("b:language") || b:language ==? "" : let b:language="american" : let @_=SpellCheck() : elseif b:language ==? "american" : let b:language="russianw" : let @_=SpellCheck() : else : let b:language="" : let @_=ExitSpell() : endif " echo "Language: ".b:language :endfunction map :let @_=SpellLanguage() map / :let @_=ProposeAlternatives() map :let @_=ProposeAlternatives() --J/dobhs11T7y2rNN-- --eAbsdosE1cNLO4uF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+HbAafBKgtDjnu0YRAhn3AKDKJSUNmfv8k+J5KvuhRVTfUUccmQCeI543 qCzGZK3XIoo5k+9+2rVVVV8= =FQrM -----END PGP SIGNATURE----- --eAbsdosE1cNLO4uF--