Skip to content

Autocomplete breaks second order ins-completion #18044

Description

@gravndal

Steps to reproduce

  1. $ vim --clean testfile
  2. set autocomplete
  3. populate registers with yy, "ayy, etc.
  4. enter insert mode
  5. <C-X><C-R><C-X><C-R>
  6. observe single word register completion

Whole line ins-completion also has the same issue, follow-up invocations of <C-X><C-L> don't insert lines as expected.

Expected behaviour

Pressing <C-X><C-R> twice should give full register completion.

Pressing <C-X><C-L> repeatedly should insert follow up lines.

Version of Vim

9.1.1646

Environment

Operating system: nixos unstable
Terminal: tmux 3.5a
TERM: tmux-256color
Shell: fish 4.0.2

Logs and stack traces

Activity

  1. girishji commented on Aug 18, 2025

    @girishji
    Contributor

    Can you try with #18048 and see it there is improvement.

  2. gravndal commented on Aug 19, 2025

    @gravndal
    Author

    That pr doesn't make a difference for this as far as I can tell.

    As a temporary workaround, creating mappings like this works:

    inoremap <C-X><C-R> <Cmd>set noac<CR><C-X><C-R><Cmd>set ac<CR>
    inoremap <C-X><C-L> <Cmd>set noac<CR><C-X><C-L><Cmd>set ac<CR>
    

    Though I don't know if that helps you pinpoint the issue.

  3. girishji commented on Aug 19, 2025

    @girishji
    Contributor

    I am not sure what the correct behavior ought to be. With :set ac when I type ^X^L on an empty line, I see a list of lines. If I type it again, the menu gets dismissed as it should be. Without autocomplete, it opens a newline when the keys are typed again (not correct). What is your use case for ^X^L?

  4. gravndal commented on Aug 19, 2025

    @gravndal
    Author

    The second <C-X><C-L> should insert the next line after the one you just completed, see this part of the docs:

            CTRL-X CTRL-L   After expanding a line you can additionally get the
                            line next to it by typing CTRL-X CTRL-L again, unless
                            a double CTRL-X is used.  Only works for loaded
                            buffers.
    

    Here's an example:

    asciicast


    Follow-up compl-current is also affected, and probably compl-keyword and compl-define.

    Follow-up compl-vim completion behaves as it should.

  5. added a commit that references this issue on Aug 23, 2025
    b4e0bd9
  6. added 3 commits that reference this issue on Aug 23, 2025
    dfc5a89
    c85e949
    963ead2
  7. gravndal commented on Aug 24, 2025

    @gravndal
    Author

    Sorry I'm a bit late, but does patch 9.1.1670 actually fix this for you @girishji?

    The example in the asciicast above still doesn't work for me with:

    $ vim --clean -c 'set ac'
    

    And

    $ vim --version
    VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 01 1980 00:00:00)
    Included patches: 1-1684
    Compiled by nixbld
    Huge version without GUI.  Features included (+) or not (-):
    +acl               +find_in_path      +multi_byte        -tcl
    +arabic            +float             +multi_lang        +termguicolors
    +autocmd           +folding           -mzscheme          +terminal
    +autochdir         -footer            +netbeans_intg     +terminfo
    -autoservername    +fork()            +num64             +termresponse
    -balloon_eval      +gettext           +packages          +textobjects
    +balloon_eval_term -hangul_input      +path_extra        +textprop
    -browse            +iconv             -perl              +timers
    ++builtin_terms    +insert_expand     +persistent_undo   +title
    +byte_offset       +ipv6              +popupwin          -toolbar
    +channel           +job               +postscript        +user_commands
    +cindent           +jumplist          +printer           +vartabs
    +clientserver      +keymap            +profile           +vertsplit
    -clipboard         +lambda            -python            +vim9script
    +cmdline_compl     +langmap           -python3           +viminfo
    +cmdline_hist      +libcall           +quickfix          +virtualedit
    +cmdline_info      +linebreak         +reltime           +visual
    +comments          +lispindent        +rightleft         +visualextra
    +conceal           +listcmds          -ruby              +vreplace
    +cryptv            +localmap          +scrollbind        -wayland
    +cscope            -lua               +signs             -wayland_clipboard
    +cursorbind        +menu              +smartindent       +wildignore
    +cursorshape       +mksession         +socketserver      +wildmenu
    +dialog_con        +modify_fname      -sodium            +windows
    +diff              +mouse             -sound             +writebackup
    +digraphs          -mouseshape        +spell             -X11
    -dnd               +mouse_dec         +startuptime       +xattr
    -ebcdic            -mouse_gpm         +statusline        -xfontset
    +emacs_tags        -mouse_jsbterm     -sun_workshop      -xim
    +eval              +mouse_netterm     +syntax            -xpm
    +ex_extra          +mouse_sgr         +tabpanel          -xsmp
    +extra_search      -mouse_sysmouse    +tag_binary        -xterm_clipboard
    -farsi             +mouse_urxvt       -tag_old_static    -xterm_save
    +file_in_path      +mouse_xterm       -tag_any_white     
       system vimrc file: "$VIM/vimrc"
         user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
     3rd user vimrc file: "~/.config/vim/vimrc"
          user exrc file: "$HOME/.exrc"
           defaults file: "$VIMRUNTIME/defaults.vim"
      fall-back for $VIM: "
    /nix/store/768w60p51x55v2vd9r2sl9m0mkvm239f-vim-3b3b93612/share/vim"
    Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
    Linking: gcc -Wl,--as-needed -o vim -lm -ltinfo 
    
  8. girishji commented on Aug 25, 2025

    @girishji
    Contributor

    The PR #18068 was not merged before closing. Please wait for chrisbra to remedy this.

  9. girishji commented on Aug 26, 2025

    @girishji
    Contributor
  10. gravndal commented on Aug 26, 2025

    @gravndal
    Author

    That fixed it, thanks.

  11. added a commit that references this issue on Sep 7, 2025
    328369a
  12. added a commit that references this issue on Sep 27, 2025
    f19f10d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions