diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-03-29 12:20:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-03-29 12:20:27 +0100 |
commit | fd133323d4e1cc9c0e61c0ce357df4d36ea148e3 (patch) | |
tree | db4227029ff088e984484404f690924f7ffa9fe1 /runtime | |
parent | 723d165c2fcd9f94af4e8719feda3b70c8f46868 (diff) |
patch 8.1.1068: cannot get all the information about current completionv8.1.1068
Problem: Cannot get all the information about current completion.
Solution: Add complete_info(). (Shougo, Hirohito Higashi, closes #4106)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 72 | ||||
-rw-r--r-- | runtime/doc/insert.txt | 7 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 1 |
3 files changed, 67 insertions, 13 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index db63a22990..623da9efac 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2019 Mar 23 +*eval.txt* For Vim version 8.1. Last change: 2019 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2267,6 +2267,7 @@ col({expr}) Number column nr of cursor or mark complete({startcol}, {matches}) none set Insert mode completion complete_add({expr}) Number add completion match complete_check() Number check for key typed during completion +complete_info([{what}]) Dict get current completion information confirm({msg} [, {choices} [, {default} [, {type}]]]) Number number of choice picked by user copy({expr}) any make a shallow copy of {expr} @@ -3452,8 +3453,8 @@ cindent({lnum}) *cindent()* See |C-indenting|. clearmatches() *clearmatches()* - Clears all matches previously defined by |matchadd()| and the - |:match| commands. + Clears all matches previously defined for the current window + by |matchadd()| and the |:match| commands. *col()* col({expr}) The result is a Number, which is the byte index of the column @@ -3538,6 +3539,55 @@ complete_check() *complete_check()* Only to be used by the function specified with the 'completefunc' option. + *complete_info()* +complete_info([{what}]) + Returns a Dictionary with information about Insert mode + completion. See |ins-completion|. + The items are: + mode Current completion mode name string. + See |completion_info_mode| for the values. + pum_visible |TRUE| if popup menu is visible. + See |pumvisible()|. + items List of completion matches. Each item is a + dictionary containing the entries "word", + "abbr", "menu", "kind", "info" and "user_data". + See |complete-items|. + selected Selected item index. First index is zero. + Index is -1 if no item is selected (showing + typed text only) + inserted Inserted string. [NOT IMPLEMENT YET] + + *complete_info_mode* + mode values are: + "" Not in completion mode + "keyword" Keyword completion |i_CTRL-X_CTRL-N| + "ctrl_x" Just pressed CTRL-X |i_CTRL-X| + "whole_line" Whole lines |i_CTRL-X_CTRL-L| + "files" File names |i_CTRL-X_CTRL-F| + "tags" Tags |i_CTRL-X_CTRL-]| + "path_defines" Definition completion |i_CTRL-X_CTRL-D| + "path_patterns" Include completion |i_CTRL-X_CTRL-I| + "dictionary" Dictionary |i_CTRL-X_CTRL-K| + "thesaurus" Thesaurus |i_CTRL-X_CTRL-T| + "cmdline" Vim Command line |i_CTRL-X_CTRL-V| + "function" User defined completion |i_CTRL-X_CTRL-U| + "omni" Omni completion |i_CTRL-X_CTRL-O| + "spell" Spelling suggestions |i_CTRL-X_s| + "eval" |complete()| completion + "unknown" Other internal modes + + If the optional {what} list argument is supplied, then only + the items listed in {what} are returned. Unsupported items in + {what} are silently ignored. + + Examples: > + " Get all items + call complete_info() + " Get only 'mode' + call complete_info(['mode']) + " Get only 'mode' and 'pum_visible' + call complete_info(['mode', 'pum_visible']) +< *confirm()* confirm({msg} [, {choices} [, {default} [, {type}]]]) confirm() offers the user a dialog, from which a choice can be @@ -4978,10 +5028,11 @@ getloclist({nr} [, {what}]) *getloclist()* details. getmatches() *getmatches()* - Returns a |List| with all matches previously defined by - |matchadd()| and the |:match| commands. |getmatches()| is - useful in combination with |setmatches()|, as |setmatches()| - can restore a list of matches saved by |getmatches()|. + Returns a |List| with all matches previously defined for the + current window by |matchadd()| and the |:match| commands. + |getmatches()| is useful in combination with |setmatches()|, + as |setmatches()| can restore a list of matches saved by + |getmatches()|. Example: > :echo getmatches() < [{'group': 'MyGroup1', 'pattern': 'TODO', @@ -7839,9 +7890,10 @@ setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()* for the list of supported keys in {what}. setmatches({list}) *setmatches()* - Restores a list of matches saved by |getmatches()|. Returns 0 - if successful, otherwise -1. All current matches are cleared - before the list is restored. See example for |getmatches()|. + Restores a list of matches saved by |getmatches() for the + current window|. Returns 0 if successful, otherwise -1. All + current matches are cleared before the list is restored. See + example for |getmatches()|. *setpos()* setpos({expr}, {list}) diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index bd4fad2c29..b747abec48 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.1. Last change: 2019 Jan 29 +*insert.txt* For Vim version 8.1. Last change: 2019 Mar 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -379,8 +379,8 @@ 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* CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U* - movement (but only if the cursor stays - within same the line) + movement, if the cursor stays within + same the line ----------------------------------------------------------------------- Note: If the cursor keys take you out of Insert mode, check the 'noesckeys' @@ -642,6 +642,7 @@ and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next), and CTRL-P (previous). +To get the current completion information, |complete_info()| can be used. Also see the 'infercase' option if you want to adjust the case of the match. *complete_CTRL-E* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 07d11f8f77..31beded6bb 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -834,6 +834,7 @@ Insert mode completion: *completion-functions* complete() set found matches complete_add() add to found matches complete_check() check if completion should be aborted + complete_info() get current completion information pumvisible() check if the popup menu is displayed Folding: *folding-functions* |