From 5a8684e7821a35e371b845b60699df527a855a9f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Jul 2005 22:43:24 +0000 Subject: updated for version 7.0120 --- runtime/menu.vim | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'runtime/menu.vim') diff --git a/runtime/menu.vim b/runtime/menu.vim index 37bd11ac26..52607235ce 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar -" Last Change: 2005 Jul 22 +" Last Change: 2005 Jul 30 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -424,22 +424,30 @@ if has("spell") an 40.335.260 &Tools.&Spelling.Set\ language\ to\ "en_us" :set spl=en_us spell an 40.335.270 &Tools.&Spelling.&Find\ More\ Languages :call SpellLang() + let s:undo_spellang = ['aun &Tools.&Spelling.&Find\ More\ Languages'] func! s:SpellLang() - silent! aun &Tools.&Spelling.&Find\ More\ Languages + for cmd in s:undo_spellang + exe "silent! " . cmd + endfor + let s:undo_spellang = [] + if &enc == "iso-8859-15" let enc = "latin1" else let enc = &enc endif + let found = 0 let s = globpath(&rtp, "spell/*." . enc . ".spl") if s != "" let n = 300 for f in split(s, "\n") let nm = substitute(f, '.*spell[/\\]\(..\)\.[^/\\]*\.spl', '\1', "") - if nm != "en" - exe 'an 40.335.' . n . ' &Tools.&Spelling.Set\ language\ to\ "' . nm . '" :set spl=' . nm . ' spell' + if nm != "en" && nm !~ '/' let found += 1 + let menuname = '&Tools.&Spelling.Set\ language\ to\ "' . nm . '"' + exe 'an 40.335.' . n . ' ' . menuname . ' :set spl=' . nm . ' spell' + let s:undo_spellang += ['aun ' . menuname] endif let n += 10 endfor @@ -451,6 +459,10 @@ if has("spell") else echomsg "Found " . found . " more spell files" endif + " Need to redo this when 'encoding' is changed. + augroup spellmenu + au! EncodingChanged * call SpellLang() + augroup END endfun endif -- cgit v1.2.3