0

According to this

My Kitty conf

map shift+enter send_text all \x1b[13;2u
map ctrl+enter send_text all \x1b[13;5u

According to this

My Tmux conf

bind -n S-Enter send-keys Escape "[13;2u"
bind -n C-Enter send-keys Escape "[13;5u"

And according to the recommended configuration example

My nvim-cmp conf

local M = {}
M.cmp_mappings = {
  ["<CR>"] = require("cmp").mapping.confirm({ select = false }),
  ["<C-j>"] = require("cmp").mapping.select_next_item(),
  ["<C-k>"] = require("cmp").mapping.select_prev_item(),
  ["<C-s>"] = require("cmp").mapping.abort(),

  ["<S-CR>"] = require("cmp").mapping.confirm({ select = true }),
  ["<C-CR>"] = require("cmp").mapping.confirm({ select = false }),
}
return M

Description

Everything seems alright according to the references I shared above. My mappings for selecting next/prev item and aborting does work. This indicates that I'm at the right point and my nvim-cmp configuration file does work along with all the other configurations!

However, my mappings Enter, Control+Enter and Shift+Enter does not work. The problem seems to occur in only those three keys/mappings.

I can confirm that:

  • When I do Ctrl+V Enter in insert mode, it writes <CR>
  • When I do Ctrl+V Shit+Enter in insert mode, it writes <S-CR>
  • When I do Ctrl+V Ctrl+Enter in insert mode, it writes <C-CR>

According to these outputs, everything seems normal and it seems like it should work, but it doesn't.

I guess Enter is the default key for selecting the autosuggestion, and I want to make it not select autosuggestions. I only want to use Shift+Enter to select autosuggestions.

One thing I noticed is, as long as I include the mappings for <S-CR> and <C-CR>, when I pressed Shift+Enter or Ctrl+Enter they both select the autosuggestion no matter how I configured their select parameter (even if I set it false). However if they're not included in the code, meaning when I remove/uncomment the lines associated with mapping <S-CR> and <C-CR>, they don't select the autosuggestion. Which once again proves that my terminal and Neovim evaluate Enter, Shift+Enter and Ctrl+Enter individually, separately.

I appreciate any help!

UPDATE

11
  • Could you tell us what is the result of :set <S-CR>? and :set <C-CR>?? What is the result of typing in insert mode Ctrl-v Shift-Enter? What is the result of typing in insert mode Ctrl-v Ctrl-Enter? Jan 24 at 18:13
  • 1
    :set <S-CR> outputs Unknown option: <S-CR> ||||||||||| :set <C-CR> outputs Unknown option: <C-CR> ||||||||||| :set <CR> outputs Key code not set: <CR> ||||||||||| Other than that, I already mentioned what Ctrl-V Shift-Enter and Ctrl-Enter resulted in insert mode in my original question.
    – f4T1H21
    Jan 24 at 19:28
  • if you issue the following commands :nmap <C-CR> <cmd>echom 'Ctrl-Enter'<CR> and :nmap <S-CR> <cmd>echom 'Shift-Enter'<CR> what is the message displayed when you type <S-CR> and <C-CR> respectively? Jan 24 at 19:56
  • 1
    Other than that, I can map both <S-CR> and <C-CR> to do something in insert mode. So I guess the problem is with nvim-cmp.
    – f4T1H21
    Jan 25 at 5:32
  • 1
    It doesnt seem to have an effect, here
    – f4T1H21
    Jan 25 at 8:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.