Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour when setting backspace=0 #825

Closed
2 tasks done
yardnsm opened this issue Mar 5, 2022 · 2 comments
Closed
2 tasks done

Strange behaviour when setting backspace=0 #825

yardnsm opened this issue Mar 5, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@yardnsm
Copy link

yardnsm commented Mar 5, 2022

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no open or closed issues with the same problem.

Neovim Version

NVIM v0.6.1

Minimal reproducible config

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

set backspace=0

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = {
    { name = "nvim_lsp" },
    { name = "buffer" },
  },
}
EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())

require'lspconfig'.cssls.setup {
  capabilities = capabilities,
}
EOF

Description

Hey!

I have just started using this plugin and noticed a strange behaviour when completing an already inserted word when using set backspace=0. The selected suggestion simply appended right after the word, rather than replace (complete) it.

Look what happens when I'm trying to complete the word "a_nice_word" while I already inserted the part "a_nice". In the following example I am also selecting the suggestion multiple times:

nvim_cmp_vid_1.mov

When I run set backspace=indent,eol,start, it behaves like it should:

nvim_cmp_vid_2.mov

It seems that when an item is being selected, the backspace option should be set to indent,eol,start and after that it should go back to the default.

I've found #347 and #343, but the issue seems to persist until now 🤷‍♂️

Steps to reproduce

  1. Use set backspace=0
  2. Go to INSERT while on a given word and try to complete it.
  3. Behold!

Expected behavior

The word should be completed from its beginning.

Actual behavior

The completion is inserted right after the word.

Additional context

No response

@yardnsm yardnsm added the bug Something isn't working label Mar 5, 2022
@hrsh7th
Copy link
Owner

hrsh7th commented Mar 6, 2022

I'll check it. Thank you!

hrsh7th pushed a commit that referenced this issue May 3, 2022
@hrsh7th hrsh7th closed this as completed in 5054c14 May 3, 2022
@Balrrach
Copy link

Balrrach commented Jun 19, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants