Closed glepnir closed 3 years ago
Try to use lexima#expand('<CR>', 'i')
instead of "\<CR>"
.
imap <expr> <cr> pumvisible() ? complete_info()["selected"] != "-1" ?
\ "\<Plug>(completion_confirm_completion)" : "\<c-e>" . lexima#expand('<CR>', 'i') : lexima#expand('<CR>', 'i')
But when load lexima , it always redefine <CR>
map ...
Ok... Please write the following codes in your vimrc
" after plugin settings like Plug "cohama/lexima.vim"
let g:lexima_no_default_rules = 1
call lexima#set_default_rules() " force load lexima.vim and define mappings
imap <expr> <CR> .... " override <CR> mapping here
works fine. Thanks a lot.
This was really helpful. Thanks! I think it is really worth adding this to the README.
Try to use
lexima#expand('<CR>', 'i')
instead of"\<CR>"
.imap <expr> <cr> pumvisible() ? complete_info()["selected"] != "-1" ? \ "\<Plug>(completion_confirm_completion)" : "\<c-e>" . lexima#expand('<CR>', 'i') : lexima#expand('<CR>', 'i')
After trying this, completion-nvim works, but new line rule no longer works for me.
Edit: Work file now after changing lexima#expand('<CR>', 'i')
to lexima#expand('<LT>CR>', 'i')
For future reference if anyone stumbles upon my (related) issue in the future (lua):
When using lexima together with nvim-cmp and pressing <cr>
while the pum menu was open, it would not give me a new line. This solved that issue (change the <C-e><cr>
mapping to what suits you):
use "cohama/lexima.vim"
...
vim.g["lexima_no_default_rules"] = 1
vim.fn["lexima#set_default_rules"]()
...
function _G.new_line_lexima()
return vim.fn.pumvisible() == 1 and vim.api.nvim_replace_termcodes("<C-e><cr>", true, true, true) or vim.fn["lexima#expand"]("<cr>", "i")
end
...
vim.api.nvim_set_keymap("i", "<cr>", "v:lua.new_line_lexima()", {expr = true, noremap = true})
I found when i load lexima. It always redefine my cr map. this is my cr map work with completion-nvim. How can i bind cr work with completion-nvim and lexima.vim new line rules?