AJES123 AJES123 - 5 months ago 23
Linux Question

neovim ultisnips activation does not recognize newline keystroke

I have installed neovim(0.1.5) on an Ubuntu based distribution with YouCompleteMe among other plugins. However, when I install Ultisnips, neovim does not recognize carriage return key in any file. Do you know how I can figure out the conflict. I tried setting TERM to xterm and xterm-256color and the issue still remains.

Here's my init.vim:

set nocompatible
filetype off

call plug#begin('~/.config/nvim/plugged')

Plug 'Valloric/YouCompleteMe'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/nerdcommenter'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

call plug#end()

filetype plugin indent on
set autowrite
"set encoding=utf-8
"set termguicolors
set cursorline
set number
set showmatch
set expandtab
set tabstop=4
set noexpandtab
set softtabstop=4
set shiftwidth=4
set splitright
set hlsearch
set colorcolumn=110
highlight ColorColumn ctermbg=darkgray

if !&scrolloff
set scrolloff=3 " Show next 3 lines while scrolling.
if !&sidescrolloff
set sidescrolloff=5 " Show next 5 columns while side-scrolling.

let mapleader="-"
set makeprg=make

"Additions for NerdTree
autocmd vimenter * NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

" Trigger configuration.
let g:UltiSnipsExpandTrigger="<c-m>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsListSnippets="<c-l>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
"let g:NERDTrimTrailingWhitespace = 1

" You Complete Me Additions
let g:ycm_global_ycm_extra_conf = '~/.config/nvim/.ycm_extra_conf.py'

" Theme Additions

" Status Line Theme Additions
let g:airline_section_b = '%{strftime("%c")}%'
let g:airline_section_y = 'BN: %{bufnr("%")}%'
let g:airline#extensions#tabline#enabled = 1


The value of TERM is irrelevant.

vim (like any vi implementation) uses newline for line-terminators. That's an ASCII line-feed, but the key you press on the keyboard, Enter actually sends an ASCII carriage-return (^M), which the terminal driver translates into line-feed.

You can override this translation by first pressing controlV (^V), called lnext (literal-next) in the output from stty -a. Doing that passes the carriage return to vim.