1

This is a re-post from my deleted post at Stack Overflow.


OS: MacOS catalina

Vim version: VIM - Vi IMproved 8.1

Problem: Can't type <>[]{}'"() and backspace in vim after :set nopaste. Typing <>[]{}'"() in insert mode does nothing and the curser just stays at the same place and so does typing delete button.

Expected Behaviour: Could type <>[]{}'"() and perform delete by backspace in insert mode.


I tried :set backspace=2 and it didn't wrok. What worked though was :set paste but it also disabled ncoc and other functionalities so it was not a solution. I thought it might be that some settings in my vimrc caused the problem but deleting my vimrc was of no avail.

Some conversations that might help figuring out the cause:

  1. It only happened after I loaded a session by source session.vim and it didn't happened after opening a normal file with e filename or from terminal.
  2. Under :set paste and :set nopaste, ctrl + r + backspace both gave <BS>
  3. When I did <tab>, paste gave 8 spaces while nopaste 4 spaces.

Any idea about the problem? Thanks so much!

  • 2
    Welcome to Vi and Vim! Sorry but I read your question a couple of times now and it's still unclear what the problem is that you're trying to report... Can you please edit the question and describe what you're trying to do, what you expected it would happen and what is happening instead? Thanks! – filbranden Aug 8 at 15:39
  • 2
    :set paste changes a whole bunch of settings to make pasting from other programs more convenient in certain scenarios; you don't really want to set it normally (and if you do set it, you want to disable it again as soon as you've finished pasting the text). It's not entirely clear to me what problem you were having in the first place? I think you thought that :set paste would fix a problem? What is that problem? – Martin Tournoij Aug 8 at 16:00
  • @filbranden sorry about the confusion! have added problem and expected behaviour to my question. – Tommy Dew Aug 8 at 19:24
  • 1
    @TommyDew "coc.nvim setting causes the problem" Alright, so I think you got your answer to why those keys are not working. Can I suggest that you post a self-answer indicating that uninstalling/disabling/removing coc.nvim fixes the issue? Now if you want help properly getting coc.nvim to work, then I recommend you post a new question about that. Describe what you're doing to set it up and why it's not working for you. (Make sure you describe everything in as much detail as you can!) – filbranden Aug 9 at 14:59
  • 1
    @filbranden in fact, it's usually views that are the issues; but sessions can be with the wrong sessionoptions. I use the plugin obsession for this, no issues so far. – D. Ben Knoble Aug 10 at 18:20
1

I found that it was that the coc.nvim caused the problem.

:verbose map <BS> shows my <BS> is mapped to coc#_insert_key('request', 'a-very-long-string') because of coc.nvim.

I solved my problem by

  1. Uninstall coc.nvim
  2. :mapclear | mapclear <buffer> | mapclear! | mapclear! <buffer> to remove all mappings.

Thanks all!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.