diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-03-10 21:42:59 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-03-10 21:42:59 +0000 |
commit | a94bc430e81fb52b982fc3bdf8da60e585b91f58 (patch) | |
tree | b335ccd1fb0df242eef75e9f422dcfd0b227582b | |
parent | 5c4bab0fe7357aa0bc38e5d29929e12f43209666 (diff) | |
download | vim-git-a94bc430e81fb52b982fc3bdf8da60e585b91f58.tar.gz |
updated for version 7.0220
-rw-r--r-- | runtime/doc/autocmd.txt | 13 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 32 | ||||
-rw-r--r-- | runtime/doc/pi_netrw.txt | 6 | ||||
-rw-r--r-- | runtime/doc/spell.txt | 5 | ||||
-rw-r--r-- | runtime/doc/tags | 9 | ||||
-rw-r--r-- | src/edit.c | 89 | ||||
-rw-r--r-- | src/structs.h | 1 | ||||
-rw-r--r-- | src/version.h | 4 |
8 files changed, 138 insertions, 21 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index edf3c1e54..6f2a57ec5 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.0aa. Last change: 2006 Mar 07 +*autocmd.txt* For Vim version 7.0aa. Last change: 2006 Mar 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -272,6 +272,9 @@ Name triggered by ~ |FileChangedShell| Vim notices that a file changed since editing started |FileChangedRO| before making the first change to a read-only file +|ShellCmdPost| after executing a shell command +|ShellFilterPost| after filtering with a shell command + |FuncUndefined| a user function is used but it isn't defined |SpellFileMissing| a spell file is used but it can't be found |SourcePre| before sourcing a Vim script @@ -667,6 +670,14 @@ RemoteReply When a reply from a Vim that functions as *SessionLoadPost* SessionLoadPost After loading the session file created using the |:mksession| command. + *ShellCmdPost* +ShellCmdPost After executing a shell command with |:!cmd|, + |:shell|, |:make| and |:grep|. Can be used to + check for any changed files. + *ShellFilterPost* +ShellFilterPost After executing a shell command with + ":{range}!cmd", ":w !cmd" or ":r !cmd". + Can be used to check for any changed files. *SourcePre* SourcePre Before sourcing a Vim script. |:source| *SpellFileMissing* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 007f66cbb..9ca5d71a2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 07 +*eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1513,6 +1513,7 @@ call( {func}, {arglist} [, {dict}]) char2nr( {expr}) Number ASCII value of first char in {expr} cindent( {lnum}) Number C indent for line {lnum} col( {expr}) Number column nr of cursor or mark +complete({startcol}, {matches}) String set Insert mode completion complete_add( {expr}) Number add completion match complete_check() Number check for key typed during completion confirm( {msg} [, {choices} [, {default} [, {type}]]]) @@ -1958,6 +1959,35 @@ col({expr}) The result is a Number, which is the byte index of the column \let &ve = save_ve<CR> < +complete({startcol}, {matches}) *complete()* *E785* + Set the matches for Insert mode completion. + Can only be used in Insert mode. You need to use a mapping + with an expression argument |:map-<expr>| or CTRL-R = + |i_CTRL-R|. It does not work after CTRL-O. + {startcol} is the byte offset in the line where the completed + text start. The text up to the cursor is the original text + that will be replaced by the matches. Use col('.') for an + empty string. "col('.') - 1" will replace one character by a + match. + {matches} must be a |List|. Each |List| item is one match. + See |complete-items| for the kind of items that are possible. + Note that the after calling this function you need to avoid + inserting anything that would completion to stop. + The match can be selected with CTRL-N and CTRL-P as usual with + Insert mode completion. The popup menu will appear if + specified, see |ins-completion-menu|. + Example: > + inoremap <expr> <F5> ListMonths() + + func! ListMonths() + call complete(col('.'), ['January', 'February', 'March', + \ 'April', 'May', 'June', 'July', 'August', 'September', + \ 'October', 'November', 'December']) + return '' + endfunc +< This isn't very useful, but it shows how it works. Note that + an empty string is returned to avoid a zero being inserted. + complete_add({expr}) *complete_add()* Add {expr} to the list of matches. Only to be used by the function specified with the 'completefunc' option. diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index b7a4ae6c4..ae39789d7 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -881,7 +881,7 @@ Netrw will not work properly with > < If either of these options are present when browsing is attempted, netrw will change them by using noacd and removing the ta suboptions from the -|formatoptions|. +|'formatoptions'|. *netrw-explore* *netrw-pexplore* *netrw-hexplore* *netrw-sexplore* @@ -1134,9 +1134,9 @@ One may use a preview window (currently only for local browsing) by using the PREVIOUS WINDOW *netrw-P* *netrw-prvwin* -To edit a file or directory in the previously used window (see :he |ctrl-w_p|), +To edit a file or directory in the previously used window (see :he |CTRL-W_P|), press a "P". If there's only one window, then the one window will be -horizontally split (above/below splitting is controlled by |g:netrw-alto|, +horizontally split (above/below splitting is controlled by |g:netrw_alto|, and its initial size is controlled by |g:netrw_winsize|). If there's more than one window, the previous window will be re-used on diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index ef8d1ade4..c2dbe1a24 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.0aa. Last change: 2006 Mar 05 +*spell.txt* For Vim version 7.0aa. Last change: 2006 Mar 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1536,7 +1536,8 @@ SYLLABLENUM (Hunspell) *spell-SYLLABLENUM* TRY (Myspell, Hunspell, others) *spell-TRY* Vim does not use the TRY item, it is ignored. For making - suggestions the actual characters in the words are used. + suggestions the actual characters in the words are used, that + is much more efficient. WORDCHARS (Hunspell) *spell-WORDCHARS* Used to recognize words. Vim doesn't need it, because there diff --git a/runtime/doc/tags b/runtime/doc/tags index ba89c010e..8f1aeffe1 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2227,12 +2227,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :map map.txt /*:map* :map! map.txt /*:map!* :map-<buffer> map.txt /*:map-<buffer>* +:map-<expr> map.txt /*:map-<expr>* :map-<script> map.txt /*:map-<script>* :map-<silent> map.txt /*:map-<silent>* :map-<unique> map.txt /*:map-<unique>* :map-alt-keys map.txt /*:map-alt-keys* :map-arguments map.txt /*:map-arguments* :map-commands map.txt /*:map-commands* +:map-expression map.txt /*:map-expression* :map-local map.txt /*:map-local* :map-modes map.txt /*:map-modes* :map-operator map.txt /*:map-operator* @@ -3922,6 +3924,7 @@ E781 spell.txt /*E781* E782 spell.txt /*E782* E783 spell.txt /*E783* E784 tabpage.txt /*E784* +E785 eval.txt /*E785* E79 message.txt /*E79* E80 message.txt /*E80* E800 arabic.txt /*E800* @@ -4124,6 +4127,8 @@ Select-mode-mapping visual.txt /*Select-mode-mapping* Session starting.txt /*Session* SessionLoad-variable starting.txt /*SessionLoad-variable* SessionLoadPost autocmd.txt /*SessionLoadPost* +ShellCmdPost autocmd.txt /*ShellCmdPost* +ShellFilterPost autocmd.txt /*ShellFilterPost* SourcePre autocmd.txt /*SourcePre* SpellFileMissing autocmd.txt /*SpellFileMissing* StdinReadPost autocmd.txt /*StdinReadPost* @@ -4638,7 +4643,9 @@ compl-spelling insert.txt /*compl-spelling* compl-tag insert.txt /*compl-tag* compl-vim insert.txt /*compl-vim* compl-whole-line insert.txt /*compl-whole-line* +complete() eval.txt /*complete()* complete-functions insert.txt /*complete-functions* +complete-items insert.txt /*complete-items* complete_add() eval.txt /*complete_add()* complete_check() eval.txt /*complete_check()* complex-change change.txt /*complex-change* @@ -5491,6 +5498,7 @@ hebrew hebrew.txt /*hebrew* hebrew.txt hebrew.txt /*hebrew.txt* help various.txt /*help* help-context help.txt /*help-context* +help-tags tags 1 help-translated various.txt /*help-translated* help-xterm-window various.txt /*help-xterm-window* help.txt help.txt /*help.txt* @@ -6207,6 +6215,7 @@ new-items-7 version7.txt /*new-items-7* new-line-continuation version5.txt /*new-line-continuation* new-location-list version7.txt /*new-location-list* new-manpage-trans version7.txt /*new-manpage-trans* +new-map-expression version7.txt /*new-map-expression* new-matchparen version7.txt /*new-matchparen* new-more-unicode version7.txt /*new-more-unicode* new-multi-byte version5.txt /*new-multi-byte* diff --git a/src/edit.c b/src/edit.c index 2feb8e80f..087ce3132 100644 --- a/src/edit.c +++ b/src/edit.c @@ -141,6 +141,9 @@ static void ins_compl_set_original_text __ARGS((char_u *str)); static void ins_compl_addfrommatch __ARGS((void)); static int ins_compl_prep __ARGS((int c)); static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag)); +#if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) +static void ins_compl_add_list __ARGS((list_T *list)); +#endif static int ins_compl_get_exp __ARGS((pos_T *ini)); static void ins_compl_delete __ARGS((void)); static void ins_compl_insert __ARGS((void)); @@ -2305,6 +2308,48 @@ ins_compl_make_cyclic() return count; } +/* + * Start completion for the complete() function. + * "startcol" is where the matched text starts (1 is first column). + * "list" is the list of matches. + */ + void +set_completion(startcol, list) + int startcol; + list_T *list; +{ + /* If already doing completions stop it. */ + if (ctrl_x_mode != 0) + ins_compl_prep(' '); + ins_compl_clear(); + + if (stop_arrow() == FAIL) + return; + + if (startcol > curwin->w_cursor.col) + startcol = curwin->w_cursor.col; + compl_col = startcol; + compl_length = curwin->w_cursor.col - startcol; + /* compl_pattern doesn't need to be set */ + compl_orig_text = vim_strnsave(ml_get_curline() + compl_col, compl_length); + if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, + -1, FALSE, NULL, NULL, 0, ORIGINAL_TEXT) != OK) + return; + + /* Handle like dictionary completion. */ + ctrl_x_mode = CTRL_X_WHOLE_LINE; + + ins_compl_add_list(list); + compl_matches = ins_compl_make_cyclic(); + compl_started = TRUE; + compl_used_match = TRUE; + + compl_curr_match = compl_first_match; + ins_complete(Ctrl_N); + out_flush(); +} + + /* "compl_match_array" points the currently displayed list of entries in the * popup menu. It is NULL when there is no popup menu. */ static pumitem_T *compl_match_array = NULL; @@ -2837,6 +2882,8 @@ ins_compl_clear() vim_free(compl_leader); compl_leader = NULL; edit_submode_extra = NULL; + vim_free(compl_orig_text); + compl_orig_text = NULL; } /* @@ -3283,7 +3330,6 @@ static void expand_by_function __ARGS((int type, char_u *base)); /* * Execute user defined complete function 'completefunc' or 'omnifunc', and * get matches in "matches". - * Return value is number of matches. */ static void expand_by_function(type, base) @@ -3292,13 +3338,8 @@ expand_by_function(type, base) { list_T *matchlist; char_u *args[2]; - listitem_T *li; - char_u *p; char_u *funcname; pos_T pos; - int dir = compl_direction; - char_u *x; - int icase; funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu; if (*funcname == NUL) @@ -3314,8 +3355,28 @@ expand_by_function(type, base) if (matchlist == NULL) return; + ins_compl_add_list(matchlist); + list_unref(matchlist); +} +#endif /* FEAT_COMPL_FUNC */ + +#if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) +/* + * Add completions from a list. + * Unreferences the list. + */ + static void +ins_compl_add_list(list) + list_T *list; +{ + listitem_T *li; + int icase; + char_u *p; + char_u *x; + int dir = compl_direction; + /* Go through the List with matches and add each of them. */ - for (li = matchlist->lv_first; li != NULL; li = li->li_next) + for (li = list->lv_first; li != NULL; li = li->li_next) { icase = p_ic; if (li->li_tv.v_type == VAR_DICT && li->li_tv.vval.v_dict != NULL) @@ -3341,10 +3402,8 @@ expand_by_function(type, base) else if (did_emsg) break; } - - list_unref(matchlist); } -#endif /* FEAT_COMPL_FUNC */ +#endif /* * Get the next expansion(s), using "compl_pattern". @@ -3765,7 +3824,8 @@ ins_compl_get_exp(ini) /* If several matches were added (FORWARD) or the search failed and has * just been made cyclic then we have to move compl_curr_match to the next * or previous entry (if any) -- Acevedo */ - compl_curr_match = compl_direction == FORWARD ? old_match->cp_next : old_match->cp_prev; + compl_curr_match = compl_direction == FORWARD ? old_match->cp_next + : old_match->cp_prev; if (compl_curr_match == NULL) compl_curr_match = old_match; return i; @@ -4596,7 +4656,12 @@ ins_complete(c) else msg_clr_cmdline(); /* necessary for "noshowmode" */ + /* RedrawingDisabled may be set when invoked through complete(). */ + n = RedrawingDisabled; + RedrawingDisabled = 0; ins_compl_show_pum(); + setcursor(); + RedrawingDisabled = n; return OK; } @@ -8082,7 +8147,7 @@ ins_mousescroll(up) #endif #if defined(FEAT_GUI_TABLINE) || defined(PROTO) - void + static void ins_tabline(c) int c; { diff --git a/src/structs.h b/src/structs.h index 6a00be193..2d538a842 100644 --- a/src/structs.h +++ b/src/structs.h @@ -928,6 +928,7 @@ struct mapblock int m_noremap; /* if non-zero no re-mapping for m_str */ char m_silent; /* <silent> used, don't echo commands */ #ifdef FEAT_EVAL + char m_expr; /* <expr> used, m_str is an expression */ scid_T m_script_ID; /* ID of script where map was defined */ #endif }; diff --git a/src/version.h b/src/version.h index c951ea317..af040a649 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 9)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 9, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 10)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 10, compiled " |