diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-01-12 23:22:24 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-01-12 23:22:24 +0000 |
commit | 4770d09abd866bb53d95895dc6a5c5fe7cccb619 (patch) | |
tree | b9ca6f4a66c7591a84cfe88fb21edb31db906a4e | |
parent | 1cbe5f739d4e75b5e16b85ae79ff0434a641b03d (diff) |
updated for version 7.0179v7.0179
68 files changed, 5372 insertions, 1820 deletions
@@ -77,6 +77,7 @@ SRC_ALL = \ src/testdir/*.in \ src/testdir/test[0-9]*.ok \ src/testdir/test49.vim \ + src/testdir/test60.vim \ src/proto.h \ src/proto/buffer.pro \ src/proto/charset.pro \ @@ -683,6 +684,9 @@ LANG_GEN_BIN = \ runtime/spell/en.ascii.spl \ runtime/spell/en.latin1.spl \ runtime/spell/en.utf-8.spl \ + runtime/spell/en.ascii.sug \ + runtime/spell/en.latin1.sug \ + runtime/spell/en.utf-8.sug \ # all files for lang archive LANG_SRC = \ diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim new file mode 100644 index 0000000000..367847c9b5 --- /dev/null +++ b/runtime/autoload/syntaxcomplete.vim @@ -0,0 +1,179 @@ +" Vim completion script +" Language: All languages, uses existing syntax highlighting rules +" Maintainer: David Fishburn <fishburn@ianywhere.com> +" Version: 1.0 +" Last Change: Sun Jan 08 2006 10:17:51 PM + +" Set completion with CTRL-X CTRL-O to autoloaded function. +if exists('&ofu') + setlocal ofu=syntaxcomplete#Complete +endif + +if exists('g:loaded_syntax_completion') + finish +endif +let g:loaded_syntax_completion = 1 + +" This script will build a completion list based on the syntax +" elements defined by the files in $VIMRUNTIME/syntax. + +let s:syn_remove_words = 'match,matchgroup=,contains,'. + \ 'links to,start=,end=,nextgroup=' + +let s:cache_name = [] +let s:cache_list = [] + +" This function is used for the 'omnifunc' option. +function! syntaxcomplete#Complete(findstart, base) + + if a:findstart + " Locate the start of the item, including "." + let line = getline('.') + let start = col('.') - 1 + let lastword = -1 + while start > 0 + if line[start - 1] =~ '\w' + let start -= 1 + elseif line[start - 1] =~ '\.' + " The user must be specifying a column name + if lastword == -1 + let lastword = start + endif + let start -= 1 + let b:sql_compl_type = 'column' + else + break + endif + endwhile + + " Return the column of the last word, which is going to be changed. + " Remember the text that comes before it in s:prepended. + if lastword == -1 + let s:prepended = '' + return start + endif + let s:prepended = strpart(line, start, lastword - start) + return lastword + endif + + let base = s:prepended . a:base + + let list_idx = index(s:cache_name, &filetype, 0, &ignorecase) + if list_idx > -1 + let compl_list = s:cache_list[list_idx] + else + let compl_list = s:SyntaxList() + let s:cache_name = add( s:cache_name, &filetype ) + let s:cache_list = add( s:cache_list, compl_list ) + endif + + " Return list of matches. + + if base =~ '\w' + let compstr = join(compl_list, ' ') + let compstr = substitute(compstr, '\<\%('.base.'\)\@!\w\+\s*', '', 'g') + let compl_list = split(compstr, '\s\+') + endif + + return compl_list +endfunc + +function! s:SyntaxList() + let saveL = @l + + " Loop through all the syntax groupnames, and build a + " syntax file which contains these names. This can + " work generically for any filetype that does not already + " have a plugin defined. + " This ASSUMES the syntax groupname BEGINS with the name + " of the filetype. From my casual viewing of the vim7\sytax + " directory. + redir @l + silent! exec 'syntax list ' + redir END + + let syntax_groups = @l + let @l = saveL + + if syntax_groups =~ 'E28' + \ || syntax_groups =~ 'E411' + \ || syntax_groups =~ 'E415' + \ || syntax_groups =~ 'No sytax items' + return -1 + endif + + " Abort names - match, links to, matchgroup=, start=, contains=, contained, + " cluster=, nextgroup=, end= + let next_group_regex = '\n' . + \ '\zs'.&filetype.'\w\+\ze'. + \ '\s\+xxx\s\+'. + \ '\<\('. + \ substitute(s:syn_remove_words, ',', '\\|', 'g'). + \ '\)\@!' + let syn_list = '' + let index = 0 + let index = match(syntax_groups, next_group_regex, index) + + + while index > 0 + let group_name = matchstr( syntax_groups, '\w\+', index ) + + let extra_syn_list = s:SyntaxGroupItems(group_name) + + let syn_list = syn_list . extra_syn_list . "\n" + + let index = index + strlen(group_name) + let index = match(syntax_groups, next_group_regex, index) + endwhile + + return sort(split(syn_list)) +endfunction + +function! s:SyntaxGroupItems( group_name ) + let saveL = @l + + " Generate (based on the syntax highlight rules) a list of + " the Statements, functions, keywords and so on available + " If this needs updating, the syntax\sql.vim file should be + " updated + redir @l + silent! exec 'syntax list ' . a:group_name + redir END + + if @l !~ 'E28' + " let syn_list = substitute( @l, '^.*xxx\s*\%(contained\s*\)\?', "", '' ) + let syn_list = substitute( @l, '^.*xxx\s*', "", '' ) + + " We only want the words for the lines begining with + " containedin, but there could be other items. + + " Tried to remove all lines that do not begin with contained + " but this does not work in all cases since you can have + " contained nextgroup=... + " So this will strip off the ending of lines with known + " keywords. + let syn_list = substitute( syn_list, '\<\('. + \ substitute( + \ escape( s:syn_remove_words, '\\/.*$^~[]') + \ , ',', '\\|', 'g'). + \ '\).\{-}\%($\|'."\n".'\)' + \ , "\n", 'g' ) + + " Now strip off the newline + blank space + contained + let syn_list = substitute( syn_list, '\%(^\|\n\)\@<=\s*\<\('. + \ 'contained\)' + \ , "", 'g' ) + + " There are a number of items which have non-word characters in + " them, *'T_F1'*. vim.vim is one such file. + " This will replace non-word characters with spaces. + let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' ) + else + let syn_list = '' + endif + + let @l = saveL + + return syn_list +endfunction + diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 28edb4d4bb..e83309a8d9 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.0aa. Last change: 2005 Dec 18 +*autocmd.txt* For Vim version 7.0aa. Last change: 2006 Jan 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -330,7 +330,7 @@ BufEnter After entering a buffer. Useful for setting *BufFilePost* BufFilePost After changing the name of the current buffer with the ":file" or ":saveas" command. - *BufReadCmd* + *BufFilePre* BufFilePre Before changing the name of the current buffer with the ":file" or ":saveas" command. *BufHidden* @@ -368,10 +368,10 @@ BufRead or BufReadPost When starting to edit a new buffer, after This does NOT work for ":r file". Not used when the file doesn't exist. Also used after successfully recovering a file. - *BufReadPre* *E200* *E201* + *BufReadCmd* BufReadCmd Before starting to edit a new buffer. Should read the file into the buffer. |Cmd-event| - *BufFilePre* + *BufReadPre* *E200* *E201* BufReadPre When starting to edit a new buffer, before reading the file into the buffer. Not used if the file doesn't exist. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 72b3c295fe..d12c1ea779 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.0aa. Last change: 2005 Dec 27 +*cmdline.txt* For Vim version 7.0aa. Last change: 2005 Dec 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -198,6 +198,8 @@ CTRL-\ e {expr} *c_CTRL-\_e* The cursor position is unchanged, except when the cursor was at the end of the line, then it stays at the end. |setcmdpos()| can be used to set the cursor position. + The |sandbox| is used for evaluating the expression to avoid + nasty side effects. Example: > :cmap <F7> <C-\>eAppendSome()<CR> :func AppendSome() diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 498833c5a7..4d12d166c0 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -1,4 +1,4 @@ -*develop.txt* For Vim version 7.0aa. Last change: 2005 Sep 01 +*develop.txt* For Vim version 7.0aa. Last change: 2006 Jan 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -382,8 +382,8 @@ checking engine in Vim, for various reasons: them separately from Vim. That's mostly not impossible, but a drawback. - Performance: A few tests showed that it's possible to check spelling on the fly (while redrawing), just like syntax highlighting. But the mechanisms - used by other code are much slower. Myspell uses a simplistic hashtable, - for example. + used by other code are much slower. Myspell uses a hashtable, for example. + The affix compression that most spell checkers use makes it slower too. - For using an external program like aspell a communication mechanism would have to be setup. That's complicated to do in a portable way (Unix-only would be relatively simple, but that's not good enough). And performance @@ -399,14 +399,88 @@ checking engine in Vim, for various reasons: another program or library would be acceptable. But the word lists probably differ, the suggestions may be wrong words. + +Spelling suggestions *develop-spell-suggestions* + +For making suggestions there are two basic mechanisms: +1. Try changing the bad word a little bit and check for a match with a good + word. Or go through the list of good words, change them a little bit and + check for a match with the bad word. The changes are deleting a character, + inserting a character, swapping two characters, etc. +2. Perform soundfolding on both the bad word and the good words and then find + matches, possibly with a few changes like with the first mechanism. + +The first is good for finding typing mistakes. After experimenting with +hashtables and looking at solutions from other spell checkers the conclusion +was that a trie (a kind of tree structure) is ideal for this. Both for +reducing memory use and being able to try sensible changes. For example, when +inserting a character only characters that lead to good words need to be +tried. Other mechanisms (with hashtables) need to try all possible letters at +every position in the word. Also, a hashtable has the requirement that word +boundaries are identified separately, while a trie does not require this. +That makes the mechanism a lot simpler. + +Soundfolding is useful when someone knows how the words sounds but doesn't +know how it is spelled. For example, the word "dictionary" might be written +as "daktonerie". The number of changes that the first method would need to +try is very big, it's hard to find the good word that way. After soundfolding +the words become "tktnr" and "tkxnry", these differ by only two letters. + +To find words by their soundfolded equivalent (soundalike word) we need a list +of all soundfolded words. A few experiments have been done to find out what +the best method is. Alternatives: +1. Do the sound folding on the fly when looking for suggestions. This means + walking through the trie of good words, soundfolding each word and + checking how different it is from the bad word. This is very efficient for + memory use, but takes a long time. On a fast PC it takes a couple of + seconds for English, which can be acceptable for interactive use. But for + some languages it takes more than ten seconds (e.g., German, Catalan), + which is unacceptable slow. For batch processing (automatic corrections) + it's to slow for all languages. +2. Use a trie for the soundfolded words, so that searching can be done just + like how it works without soundfolding. This requires remembering a list + of good words for each soundfolded word. This makes finding matches very + fast but requires quite a lot of memory, in the order of 1 to 10 Mbyte. + For some languages more than the original word list. +3. Like the second alternative, but reduce the amount of memory by using affix + compression and store only the soundfolded basic word. This is what Aspell + does. Disadvantage is that affixes need to be stripped from the bad word + before soundfolding it, which means that mistakes at the start and/or end + of the word will cause the mechanism to fail. Also, this becomes slow when + the bad word is quite different from the good word. + +The choice made is to use the second mechanism and use a separate file. This +way a user with sufficient memory can get very good suggestions while a user +who is short of memory or just wants the spell checking and no suggestions +doesn't use so much memory. + + +Word frequency + +For sorting suggestions it helps to know which words are common. In theory we +could store a word frequency with the word in the dictionary. However, this +requires storing a count per word. That degrades word tree compression a lot. +And maintaining the word frequency for all languages will be a heavy task. +Also, it would be nice to prefer words that are already in the text. This way +the words that appear in the specific text are preferred for suggestions. + +What has been implemented is to count words that have been seen during +displaying. A hashtable is used to quickly find the word count. The count is +initialized from words listed in COMMON items in the affix file, so that it +also works when starting a new file. + +This isn't ideal, because the longer Vim is running the higher the counts +become. But in practice it is a noticable improvement over not using the word +count. + ============================================================================== 4. Assumptions *design-assumptions* Size of variables: char 8 bit signed char_u 8 bit unsigned -int 16, 32 or 64 bit signed -unsigned 16, 32 or 64 bit unsigned +int 32 or 64 bit signed (16 might be possible with limited features) +unsigned 32 or 64 bit unsigned (16 as with ints) long 32 or 64 bit signed, can hold a pointer Note that some compilers cannot handle long lines or strings. The C89 diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7d70582016..4c527e1a12 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Dec 27 +*eval.txt* For Vim version 7.0aa. Last change: 2006 Jan 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1419,7 +1419,7 @@ v:swapchoice |SwapExists| autocommands can set this to the selected choice no SwapExists autocommand. The default is empty. *v:swapcommand* *swapcommand-variable* -v:swapcommand Normal mode ommand to be executed after a file has been +v:swapcommand Normal mode command to be executed after a file has been opened. Can be used for a |SwapExists| autocommand to have another Vim open the file and jump to the right place. For example, when jumping to a tag the value is ":tag tagname\r". @@ -4381,6 +4381,10 @@ system({expr} [, {input}]) *system()* *E677* The resulting error code can be found in |v:shell_error|. This function will fail in |restricted-mode|. + + Note that any wrong value in the options mentioned above may + make the function fail. It has also been reported to fail + when using a security agent application. Unlike ":!cmd" there is no automatic check for changed files. Use |:checktime| to force a check. @@ -6814,6 +6818,7 @@ These items are not allowed in the sandbox: - executing a shell command - reading or writing a file - jumping to another buffer or editing a file + - executing Python, Perl, etc. commands This is not guaranteed 100% secure, but it should block most attacks. *:san* *:sandbox* diff --git a/runtime/doc/if_mzsch.txt b/runtime/doc/if_mzsch.txt index 0580891e24..d0fd793a26 100644 --- a/runtime/doc/if_mzsch.txt +++ b/runtime/doc/if_mzsch.txt @@ -1,4 +1,4 @@ -*if_mzsch.txt* For Vim version 7.0aa. Last change: 2005 May 08 +*if_mzsch.txt* For Vim version 7.0aa. Last change: 2006 Jan 05 VIM REFERENCE MANUAL by Sergey Khorev @@ -10,6 +10,7 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme* 2. Examples |mzscheme-examples| 3. Threads |mzscheme-threads| 4. The Vim access procedures |mzscheme-vim| +5. Dynamic loading |mzscheme-dynamic| {Vi does not have any of these commands} @@ -243,5 +244,23 @@ Windows *mzscheme-window* a pair (linenr . column). (set-cursor (line . col) [window]) Set cursor position. +============================================================================== +5. Dynamic loading *mzscheme-dynamic* + +On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version| +output then includes |+mzscheme/dyn|. + +This means that Vim will search for the MzScheme DLL files only when needed. +When you don't use the MzScheme interface you don't need them, thus you can +use Vim without these DLL files. + +To use the MzScheme interface the MzScheme DLLs must be in your search path. +In a console window type "path" to see what directories are used. + +The names of the DLLs must match the MzScheme version Vim was compiled with. +For MzScheme version 209 they will be "libmzsch209_000.dll" and +"libmzgc209_000.dll". To know for sure edit "gvim.exe" and search for +"libmzsch\d\d\d_\d\d\d\.dll\c". + ====================================================================== vim:tw=78:ts=8:sts=4:ft=help:norl: diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 6c5037c882..96a6c612dd 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.0aa. Last change: 2005 Dec 23 +*index.txt* For Vim version 7.0aa. Last change: 2006 Jan 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1069,7 +1069,8 @@ The commands are sorted on the non-optional part of their name. |:cNfile| :cNf[ile] go to last error in previous file |:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode |:cabclear| :cabc[lear] clear all abbreviations for Command-line mode -|:caddfile| :cad[dfile] add error message to current quickfix list +|:caddexpr| :cad[dexpr] add errors from expr +|:caddfile| :caddf[ile] add error message to current quickfix list |:call| :cal[l] call a function |:catch| :cat[ch] part of a :try command |:cbuffer| :cb[uffer] parse error messages and jump to first error diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index f7db100cbb..0a28038dc2 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.0aa. Last change: 2005 Dec 28 +*insert.txt* For Vim version 7.0aa. Last change: 2006 Jan 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -354,7 +354,7 @@ CTRL-G CTRL-J cursor one line down, insert start column *i_CTRL-G_CTRL-J* <MouseUp> scroll three lines up *i_<MouseUp>* <S-MouseUp> scroll a full page up *i_<S-MouseUp>* CTRL-O execute one command, return to Insert mode *i_CTRL-O* -CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O* +CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O* CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L* CTRL-G u break undo sequence, start new change *i_CTRL-G_u* ----------------------------------------------------------------------- @@ -963,8 +963,8 @@ The menu is used when: While the menu is displayed these keys have a special meaning: <CR> and <Enter>: Accept the currently selected match -<Up>: Select the previous match, as if CTRL-P was used -<Down>: Select the next match, as if CTRL-N was used +<Up>: Select the previous match, as if CTRL-P was used +<Down>: Select the next match, |