From: Alexey Tourbin <at@turbinal.org>
To: community@altlinux.ru
Subject: [Comm] .vimispell.vim
Date: Thu, 9 Jan 2003 20:23:38 +0300
Message-ID: <20030109172338.GA17481@ungrund> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 95 bytes --]
Может кому надо... или может у кого лучше есть?
--
WBR, Alexey Tourbin
BIOZAK Ltd., Russia
[-- Attachment #1.2: .vimispell.vim --]
[-- Type: text/plain, Size: 4309 bytes --]
" Use ispell to highlight spellig errors
" Author: Claudio Fleiner <claudio@fleiner.com>
" Modified by Alexey Tourbin <at@turbinal.org>
" F6 - write file, spell file & highlight spelling mistakes;
" - switch between american russianw and spelling
" - return to normal syntax coloring
" <ALT>I - insert word under cursor into directory
" <ALT>U - insert word under cursor as lowercase into directory
" <ALT>A - accept word for this session only
" <alt>/ - check for alternatives
:function! ProposeAlternatives()
: let @_=CheckSpellLanguage()
: let alter=system("echo ".expand("<cword>")." | 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\\\")<CR> | echo \\\"%d: %s\\\" | \",i,$i,i,$i; }'")
: if alter !=? ""
: echo "Checking ".expand("<cword>").": Type 0 for no change, r to replace or"
: exe alter
: map 0 <cr>:let r=SpellRemoveMappings()<cr>
: 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."\<esc>"
: let r=SpellRemoveMappings()
:endfunction
:function! ExitSpell()
: syntax on
: unmap <esc>i
: unmap <esc>u
: unmap <esc>a
: unmap <esc>n
: unmap <esc>p
: unmap <m-i>
: unmap <m-u>
: unmap <m-a>
: unmap <m-n>
: unmap <m-p>
: 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 <ESC>i :let @_=system("echo \\\*".expand("<cword>")." \| ispell -a -d ".b:language)<CR>:syn case match<cr>:exe "syn match SpellCorrected \"\\<".expand("<cword>")."\\>\" transparent contains=NONE ".b:spell_options<cr><cr><c-l>
: map <ESC>u :let @_=system("echo \\\&".expand("<cword>")." \| ispell -a -d ".b:language)<CR>:syn case ignore<cr>:exe "syn match SpellCorrected \"\\<".expand("<cword>")."\\>\" transparent contains=NONE ".b:spell_options<cr><cr><c-l>
: map <ESC>a :syn case match<cr>:exe "syn match SpellCorrected \"\\<".expand("<cword>")."\\>\" transparent contains=NONE ".b:spell_options<cr><c-l>
: exe "map <esc>n /".b:spellerrors."\<cr>"
: exe "map <esc>p ?".b:spellerrors."\<cr>"
: map <m-i> :let @_=system("echo \\\*".expand("<cword>")." \| ispell -a -d ".b:language)<CR>:syn case match<cr>:exe "syn match SpellCorrected \"\\<".expand("<cword>")."\\>\" transparent contains=NONE ".b:spell_options<cr><cr><c-l>
: map <m-u> :let @_=system("echo \\\&".expand("<cword>")." \| ispell -a -d ".b:language)<CR>:syn case ignore<cr>:exe "syn match SpellCorrected \"\\<".expand("<cword>")."\\>\" transparent contains=NONE ".b:spell_options<cr><cr><c-l>
: map <m-a> :syn case match<cr>:exe "syn match SpellCorrected \"\\<".expand("<cword>")."\\>\" transparent contains=NONE ".b:spell_options<cr><c-l>
: exe "map <m-n> /".b:spellerrors."\<cr>"
: exe "map <m-p> ?".b:spellerrors."\<cr>"
: syn cluster Spell contains=SpellErrors,SpellCorrected
: hi link SpellErrors Error
: exe "normal \<cr>"
: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 <F6> :let @_=SpellLanguage()<cr>
map <ESC>/ :let @_=ProposeAlternatives()<CR>
map <m-/> :let @_=ProposeAlternatives()<CR>
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2003-01-09 17:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-09 17:23 Alexey Tourbin [this message]
2003-01-11 20:19 ` Pavel Shurubura
2003-01-13 17:28 ` [Comm] .vimispell.vim Alexey Tourbin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030109172338.GA17481@ungrund \
--to=at@turbinal.org \
--cc=community@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git