/usr/share/vim/cream/cream-spell.vim is in cream 0.43-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | "
" cream-spell.vim
"
" Cream -- An easy-to-use configuration of the famous Vim text editor
" [ http://cream.sourceforge.net ] Copyright (C) 2001-2011 Steve Hall
"
" License:
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation; either version 3 of the License, or
" (at your option) any later version.
" [ http://www.gnu.org/licenses/gpl.html ]
"
" This program is distributed in the hope that it will be useful, but
" WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
" General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program; if not, write to the Free Software
" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
" 02111-1307, USA.
"
function! Cream_spellcheck(...)
" toggle error highlighting on/off
if !exists("b:cream_spell")
" set
let b:cream_spell = 1
set spell
else
" unset
unlet b:cream_spell
set nospell
endif
" reselect if visual
if a:0 > 1
if a:1 == "v"
normal gv
endif
endif
endfunction
function! Cream_spell_altword(...)
" Show alternate words
" turn on temporarily, if not already
if !exists("b:cream_spell")
let spellontemp = 1
call Cream_spellcheck()
endif
"" TODO: broken, hangs with trailing "Hit any key..."
"let mycmdheight = &cmdheight
"set cmdheight=13
"set spellsuggest=10
"silent normal z=
"let &cmdheight = mycmdheight
" TEST WORD: spelll
let word = expand("<cword>")
if word != ""
" rework Popup menu
silent! unmenu PopUp
silent! unmenu! PopUp
amenu <silent> PopUp.Alternate\ spellings <Nul>
amenu <silent> PopUp.(pick\ to\ replace) <Nul>
amenu <silent> PopUp.--PopUp-- <Nul>
let max = 20
let words = spellsuggest(word, max)
let i = 0
while i < max
" add item to popup
let item = get(words, i)
execute 'imenu <silent> PopUp.' . item . ' <C-b>:call Cream_spell_altword_replace("' . item . '")<CR>'
execute 'vmenu <silent> PopUp.' . item . ' :<C-u>call Cream_spell_altword_replace("' . item . '")<CR>'
let i = i + 1
endwhile
elseif word == ""
call confirm(
\ "Not currently on a word.\n" .
\ "\n", "&Ok", 1, "Info")
return 0
else
" do normal right click behavior
return -1
endif
" display
" silent causes first usage to do nothing (Win95, 2003-04-04)
" BUG HACK: first time through, fails, do twice
if !exists("g:cream_popup")
let g:cream_popup = 1
silent! popup PopUp
endif
silent! popup PopUp
"" un-backup space check
"normal l
" restore original state of spell check
if exists("spellontemp")
call Cream_spellcheck()
endif
" reselect if visual
if a:0 > 1
if a:1 == "v"
normal gv
endif
endif
endfunction
function! Cream_spell_altword_replace(word)
" select word under cursor and replace with a:word
normal viw
let @x = a:word
" paste over selection
normal "xp
endfunction
|