1
0
forked from aniani/vim

117 Commits

Author SHA1 Message Date
zeertzjq
85f36d61e0
patch 9.1.0774: "shellcmdline" doesn't work with getcompletion()
Problem:  "shellcmdline" doesn't work with getcompletion().
Solution: Use set_context_for_wildcard_arg() (zeertzjq).

closes: #15834

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-10-10 19:14:13 +02:00
glepnir
0fe17f8ffb
patch 9.1.0771: completion attribute hl_group is confusing
Problem:  Currently completion attribute hl_group is combined with
          all items, which is redundant and confusing with kind_hlgroup
Solution: Renamed to abbr_hlgroup and combine it only with the abbr item
          (glepnir).

closes: #15818

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-10-08 22:26:44 +02:00
Ruslan Russkikh
0407d621bb
patch 9.1.0770: current command line completion is a bit limited
Problem:  current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
          function (Ruslan Russkikh).

closes: #15823

Signed-off-by: Ruslan Russkikh <dvrussk@yandex.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-10-08 22:24:04 +02:00
zeertzjq
4100852e09
patch 9.1.0629: Rename of pum hl_group is incomplete
Problem:  Rename of pum hl_group is incomplete in source.
Solution: Also rename the test function.  Rename to user_hlattr in code
          to avoid confusion with pum_extra.  Add test with matched text
          highlighting (zeertzjq).

closes: #15348

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-27 13:21:49 +02:00
glepnir
508e7856ec
patch 9.1.0618: cannot mark deprecated attributes in completion menu
Problem:  cannot mark deprecated attributes in completion menu
Solution: add hl_group to the Dictionary of supported completion fields
          (glepnir)

closes: #15314

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-25 21:39:08 +02:00
LemonBoy
a20bf69a3b
patch 9.1.0568: Cannot expand paths from 'cdpath' setting
Problem:  Cannot expand paths from 'cdpath' setting
          (Daniel Hahler)
Solution: Implement 'cdpath' completion, add the new 'dir_in_path'
          completion type (LemonBoy)

fixes #374
closes: #15205

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-11 22:45:42 +02:00
zeertzjq
d8c9340fc6
patch 9.1.0495: Matched text isn't highlighted in cmdline pum
Problem:  Matched text isn't highlighted in cmdline pum.
Solution: Use cmdline completion pattern in cmdline mode.
          (zeertzjq)

closes: #15029

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-17 18:25:32 +02:00
Doug Kearns
81642d9d6f
patch 9.1.0010: Keymap completion is not available
Problem:  Keymap completion is not available
Solution: Add keymap completion (Doug Kearns)

Add keymap completion to the 'keymap' option, user commands and builtin
completion functions.

closes: #13692

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04 22:37:44 +01:00
Yee Cheng Chin
209ec90b9b
patch 9.0.2037: A few remaining cmdline completion issues with C-E/Y
Problem:  A few remaining cmdline completion issues with C-E/Y
Solution: Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not
          used at the end

Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end

A few places in the cmdline completion code only works properly when the
user hits Tab (or 'wildchar') at the end of the cmdline, even though
it's supposed to work even in the middle of the line.

For fuzzy search, `:e ++ff`, and `:set hl=`, fix completion code to make
sure to use `xp_pattern_len` instead of assuming the entire `xp_pattern`
is the search pattern (since it contains texts after the cursor).

Fix Ctrl-E / Ctrl-Y to not jump to the end when canceling/accepting a
wildmenu completion. Also, make them work even when not using
`set wildoptions+=pum` as there is no drawback to doing so.
(Related issue where this was brought up: #13331)

closes: #13362

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 10:56:25 +02:00
Yee Cheng Chin
989426be6e
patch 9.0.2025: no cmdline completion for ++opt args
Problem:  no cmdline completion for ++opt args
Solution: Add cmdline completion for :e ++opt=arg and :terminal
          [++options]

closes: #13319

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-14 11:46:51 +02:00
Yee Cheng Chin
54844857fd
patch 9.0.2009: cmdline-completion for comma-separated options wrong
Problem:  cmdline-completion for comma-separated options wrong
Solution: Fix command-line expansions for options with filenames with
          commas

Fix command-line expansions for options with filenames with commas

Cmdline expansion for option values that take a comma-separated list
of file names is currently not handling file names with commas as the
commas are not escaped. For such options, the commas in file names need
to be escaped (to differentiate from a comma that delimit the list
items). The escaped comma is unescaped in `copy_option_part()` during
option parsing.

Fix as follows:
- Cmdline completion for option values with comma-separated file/folder
  names will not start a new match when seeing `\\,` and will instead
  consider it as one value.
- File/folder regex matching will strip the `\\` when seeing `\\,` to
  make sure it can match the correct files/folders.
- The expanded value will escape `,` with `\\,`, similar to how spaces
  are escaped to make sure the option value is correct on the cmdline.

This fix also takes into account the fact that Win32 Vim handles file
name escaping differently. Typing '\,' for a file name results in it
being handled literally but in other platforms '\,' is interpreted as a
simple ',' and commas need to be escaped using '\\,' instead.

Also, make sure this new logic only applies to comma-separated options
like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex
commands like `:edit <Tab>` do not require escaping and will continue to
work.

Also fix up documentation to be clearer. The original docs are slightly
misleading in how it discusses triple slashes for 'tags'.

closes: #13303
related: #13301

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-09 18:12:31 +02:00
Yee Cheng Chin
900894b09a
patch 9.0.1958: cannot complete option values
Problem:  cannot complete option values
Solution: Add completion functions for several options

Add cmdline tab-completion for setting string options

Add tab-completion for setting string options on the cmdline using
`:set=` (along with `:set+=` and `:set-=`).

The existing tab completion for setting options currently only works
when nothing is typed yet, and it only fills in with the existing value,
e.g. when the user does `:set diffopt=<Tab>` it will be completed to
`set diffopt=internal,filler,closeoff` and nothing else. This isn't too
useful as a user usually wants auto-complete to suggest all the possible
values, such as 'iblank', or 'algorithm:patience'.

For set= and set+=, this adds a new optional callback function for each
option that can be invoked when doing completion. This allows for each
option to have control over how completion works. For example, in
'diffopt', it will suggest the default enumeration, but if `algorithm:`
is selected, it will further suggest different algorithm types like
'meyers' and 'patience'. When using set=, the existing option value will
be filled in as the first choice to preserve the existing behavior. When
using set+= this won't happen as it doesn't make sense.

For flag list options (e.g. 'mouse' and 'guioptions'), completion will
take into account existing typed values (and in the case of set+=, the
existing option value) to make sure it doesn't suggest duplicates.

For set-=, there is a new `ExpandSettingSubtract` function which will
handle flag list and comma-separated options smartly, by only suggesting
values that currently exist in the option.

Note that Vim has some existing code that adds special handling for
'filetype', 'syntax', and misc dir options like 'backupdir'. This change
preserves them as they already work, instead of converting to the new
callback API for each option.

closes: #13182

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-09-29 20:42:32 +02:00
zeertzjq
28a23602e8
patch 9.0.1956: Custom completion skips orig cmdline if it invokes glob()
Problem:  Custom cmdline completion skips original cmdline when pressing
          Ctrl-P at first match if completion function invokes glob().
Solution: Move orig_save into struct expand_T.

closes: #13216

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-09-29 19:58:35 +02:00
Yegappan Lakshmanan
d4e4ecbb37
patch 9.0.1795: Indentation issues
Problem:  Indentation issues
Solution: Fix code indentation issues.

closes: #12906

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-27 18:35:45 +02:00
Shougo Matsushita
92997dda78
patch 9.0.1774: no support for custom cmdline completion
Problem:  no support for custom cmdline completion
Solution: Add new vimscript functions

Add the following two functions:
- getcmdcompltype() returns custom and customlist functions

- getcompletion() supports both custom and customlist

closes: #12228

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2023-08-20 20:55:55 +02:00
zeertzjq
e9ef347c13
patch 9.0.1735: Rename completion specific findex var
Problem: Rename completion specific findex var
Solution: Move "findex" static variable to xp_selected in expand_T

closes: #12548

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-17 23:57:05 +02:00
zeertzjq
e4c79d3615
patch 9.0.1714: getcompletion() "cmdline" fails after :autocmd
Problem:  getcompletion() "cmdline" fails after :autocmd
Solution: Use set_cmd_context() instead of set_one_cmd_context().

closes: #12804

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-15 22:41:53 +02:00
zeertzjq
094dd152fe patch 9.0.1636: expanding a pattern interferes with cmdline completion
Problem:    Expanding a pattern interferes with command line completion.
Solution:   Set the file index only when appropriate. (closes #12519)
2023-06-15 22:51:57 +01:00
Bram Moolenaar
79cdf026f1 patch 9.0.1571: RedrawingDisabled not used consistently
Problem:    RedrawingDisabled not used consistently.
Solution:   Avoid RedrawingDisabled going negative.  Set RedrawingDisabled in
            win_split_ins(). (closes #11961)
2023-05-20 14:07:00 +01:00
Bram Moolenaar
048d9d2521 patch 9.0.1520: completion for option name includes all bool options
Problem:    Completion for option name includes all bool options.
Solution:   Do not recognize the "noinv" prefix.  Prefix "no" or "inv" when
            appropriate.
2023-05-06 22:21:11 +01:00
Bram Moolenaar
f39d9e9dca patch 9.0.1479: small source file problems; outdated list of distrib. files
Problem:    Small source file problems; outdated list of distributed files.
Solution:   Small updates to source files and list of distributed files.
2023-04-22 22:54:40 +01:00
zeertzjq
b0d45ec67f patch 9.0.1242: code for :runtime completion is not consistent
Problem:    Code for :runtime completion is not consistent.
Solution:   Make code for cmdline expansion more consistent. (closes #11875)
2023-01-25 15:04:22 +00:00
zeertzjq
5c8771bc5a patch 9.0.1238: :runtime completion can be further improved
Problem:    :runtime completion can be further improved.
Solution:   Also complete the {where} argument values and adjust the
            completion for that. (closes #11874)
2023-01-24 12:34:03 +00:00
zeertzjq
3770f4c9cd patch 9.0.1231: completion of :runtime does not handle {where} argument
Problem:    Completion of :runtime does not handle {where} argument.
Solution:   Parse the {where} argument. (closes #11863)
2023-01-22 18:38:51 +00:00
root
a6759381a5 patch 9.0.1227: no cmdline completion for :runtime
Problem:    No cmdline completion for :runtime.
Solution:   Add completion for :runtime. (closes #11853, closes #11447)
            Improve the resulting matches.
2023-01-21 21:56:06 +00:00
Yegappan Lakshmanan
1cfb14aa97 patch 9.0.1166: code is indented more than necessary
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11792)
2023-01-09 19:04:23 +00:00
zeertzjq
c51a376265 patch 9.0.1043: macro has confusing name and is duplicated
Problem:    Macro has confusing name and is duplicated.
Solution:   Use one macro with an understandable name. (closes #11686)
2022-12-10 10:22:29 +00:00
Bram Moolenaar
038e6d20e6 patch 9.0.1030: using freed memory with the cmdline popup menu
Problem:    Using freed memory with the cmdline popup menu.
Solution:   Clear the popup menu when clearing the matches. (closes #11677)
2022-12-08 12:00:50 +00:00
Bram Moolenaar
698a00f55d patch 9.0.0883: a silent mapping may cause dots on the command line
Problem:    A silent mapping may cause dots on the command line.
Solution:   Don't show dots for completion if they are not going to be removed
            again. (closes #11501)
2022-11-14 22:07:45 +00:00
K.Takata
161b6ac04f patch 9.0.0880: preprocessor indenting is off
Problem:    Preprocessor indenting is off.
Solution:   Adjust preprocessor indentation. (Ken Takata, closes #11546)
2022-11-14 15:31:07 +00:00
Yegappan Lakshmanan
68353e5270 patch 9.0.0876: code is indented more than needed
Problem:    Code is indented more than needed.
Solution:   Split ExpandEscape() in two. (Yegappan Lakshmanan, closes #11539)
2022-11-13 22:38:10 +00:00
Bram Moolenaar
d6e91385f0 patch 9.0.0867: wildmenu redrawing code is spread out
Problem:    Wildmenu redrawing code is spread out.
Solution:   Refactor to move code together. (closes #11528)
2022-11-12 17:44:13 +00:00
Bram Moolenaar
747f110420 patch 9.0.0498: various small issues
Problem:    Various small issues.
Solution:   Various small fixes.
2022-09-18 13:06:41 +01:00
Yegappan Lakshmanan
8deb2b30c7 patch 9.0.0359: error message for wrong argument type is not specific
Problem:    Error message for wrong argument type is not specific.
Solution:   Include more information in the error. (Yegappan Lakshmanan,
            closes #11037)
2022-09-02 15:15:27 +01:00
zeertzjq
d3de178e53 patch 9.0.0346: :horizontal modifier not fully supported
Problem:    :horizontal modifier not fully supported.
Solution:   Also use :horizontal for completion and user commands.
            (closes #11025)
2022-09-01 12:58:52 +01:00
Bram Moolenaar
58dcbf1c65 patch 9.0.0281: build failure without the +eval feature
Problem:    Build failure without the +eval feature.
Solution:   Add #ifdef.
2022-08-26 19:58:49 +01:00
Bram Moolenaar
5416232707 patch 9.0.0279: the tiny version has the popup menu but not 'wildmenu'
Problem:    The tiny version has the popup menu but not 'wildmenu'.
Solution:   Graduate the wildmenu feature.
2022-08-26 16:58:51 +01:00
zeertzjq
b82a2ab8ad patch 9.0.0236: popup menu not removed when 'wildmenu' reset while visible
Problem:    Popup menu not removed when 'wildmenu' reset while it is visible.
Solution:   Do not check p_wmnu, only pum_visible(). (closes #10953)
2022-08-21 14:33:57 +01:00
Bram Moolenaar
57e95179ab patch 9.0.0231: expanding "**" may loop forever with directory links
Problem:    Expanding "**" may loop forever with directory links.
Solution:   Check for being interrupted. (closes #10946)
2022-08-20 19:26:14 +01:00
Bram Moolenaar
a4d158b3c8 patch 9.0.0206: redraw flags are not named specifically
Problem:    Redraw flags are not named specifically.
Solution:   Prefix "UPD_" to the flags, for UPDate_screen().
2022-08-14 14:17:45 +01:00
Yegappan Lakshmanan
7db3a8e329 patch 9.0.0089: fuzzy argument completion doesn't work for shell commands
Problem:    Fuzzy argument completion doesn't work for shell commands.
Solution:   Check for cmdidx not being CMD_bang. (Yegappan Lakshmanan,
            closes #10769)
2022-07-26 22:01:36 +01:00
Bram Moolenaar
93a1096fe4 patch 8.2.5107: some callers of rettv_list_alloc() check for not OK
Problem:    Some callers of rettv_list_alloc() check for not OK. (Christ van
            Willegen)
Solution:   Use "==" instead of "!=" when checking the return value.
2022-06-16 11:42:09 +01:00
Christian Brabandt
cb747899bd patch 8.2.4917: fuzzy expansion of option names is not right
Problem:    Fuzzy expansion of option names is not right.
Solution:   Pass the fuzzy flag down the call chain. (Christian Brabandt,
            closes #10380, closes #10318)
2022-05-08 21:10:56 +01:00
Shougo Matsushita
79d599b877 patch 8.2.4903: cannot get the current cmdline completion type and position
Problem:    Cannot get the current cmdline completion type and position.
Solution:   Add getcmdcompltype() and getcmdscreenpos(). (Shougo Matsushita,
            closes #10344)
2022-05-07 12:48:29 +01:00
Bram Moolenaar
11a57dfd16 patch 8.2.4738: Esc on commandline executes command instead of abandoning it
Problem:    Esc on commandline executes command instead of abandoning it.
Solution:   Save and restore KeyTyped when removing the popup menu.
            (closes #10154)
2022-04-11 19:38:56 +01:00
Bram Moolenaar
c6e0a5e98c patch 8.2.4732: duplicate code to free fuzzy matches
Problem:    Duplicate code to free fuzzy matches.
Solution:   Bring back fuzmatch_str_free().
2022-04-10 18:09:06 +01:00
Yegappan Lakshmanan
454ce6737c patch 8.2.4617: no completion for :scriptnames
Problem:    No completion for :scriptnames.
Solution:   Implement :scriptnames completion. (Yegappan Lakshmanan,
            closes #10005)
2022-03-24 11:22:13 +00:00
Yegappan Lakshmanan
e7dd0fa2c6 patch 8.2.4608: getcompletion() does not work when 'wildoptions' has "fuzzy"
Problem:    getcompletion() does not work properly when 'wildoptions
            contains "fuzzy".
Solution:   Do not use addstar(). (Yegappan Lakshmanan, closes #9992,
            closes #9986)
2022-03-22 16:06:31 +00:00
Yegappan Lakshmanan
5cffa8df7e patch 8.2.4579: cannot use page-up and page-down in the cmdline popup menu
Problem:    Cannot use page-up and page-down in the command line completion
            popup menu.
Solution:   Check for to page-up and page-down keys. (Yegappan Lakshmanan,
            closes #9960)
2022-03-16 13:33:53 +00:00
Yegappan Lakshmanan
1fdf84e033 patch 8.2.4570: no command line completion for :profile and :profdel
Problem:    No command line completion for :profile and :profdel.
Solution:   Implement completion. (Yegappan Lakshmanan, closes #9955)
2022-03-15 10:53:09 +00:00