0

When pressing tab in any language in edit mode, nothing happens if the character before the cursor is not a space or a tab. Doing ctrl-v tab works, but I don't want to have to do that every time and presumably it would cause some problems if I rebind tab to that.

When doing nvim --clean, I have no problems, but before I uninstall every plugin and start from the top, does anyone know which plugin or piece of config may be causing this?

Config:

https://github.com/pseud0n/nixos-config/blob/main/home-manager/home.nix#L205

https://github.com/pseud0n/nixos-config/blob/main/home-manager/config/nvim/init.vim

3
  • vi.stackexchange.com/q/2003/10604 and :verbose set expandtab?, perhaps
    – D. Ben Knoble
    Jul 31 '21 at 22:10
  • 1
    Does :imap <Tab> show a mapping for Tab in Insert mode?
    – filbranden
    Aug 1 '21 at 0:06
  • 1
    Looks like it's the mapping from line 262 of your init.vim, which is triggering coc#refresh() on tab, unless on a pop-up menu or when preceded by whitespace...
    – filbranden
    Aug 1 '21 at 0:10
0

From https://github.com/neoclide/coc.nvim/wiki/Completion-with-sources#improve & https://bleepcoder.com/coc-nvim/421789422/issue-on-pressing-tab-at-the-end-of-a-word, a better version without this problem:

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction
2
  • You should probably show the check_back_space definition to make the answer complete
    – D. Ben Knoble
    Aug 11 '21 at 11:09
  • Also, the posted code sets two mappings for tab—the second will completely override the first?
    – D. Ben Knoble
    Aug 11 '21 at 11:10

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.