Skip to content

Instantly share code, notes, and snippets.

@davidosomething
Last active September 28, 2015 21:45
Show Gist options
  • Save davidosomething/01b752d81d63c5463d88 to your computer and use it in GitHub Desktop.
Save davidosomething/01b752d81d63c5463d88 to your computer and use it in GitHub Desktop.
neocomplete.vim test
if &compatible | set nocompatible | endif
set number
" whitespace
set nowrap
set autoindent
set preserveindent " stay indented when press enter
set expandtab " spaces instead of tabs
set tabstop=2
set shiftwidth=2
set shiftround " use multiple of shiftwidth when
set smarttab
" indenting with '<' and '>'
set softtabstop=2 " tabs look like 2 spaces
set backspace=indent,eol,start " bs anything
" clipboard -- use os clipboard
if (exists("$DISPLAY") || has('mac')) && has('clipboard')
set clipboard=unnamed " Share system clipboard.
if has('unnamedplus')
set clipboard+=unnamedplus " Share X windows clipboard.
endif
endif
augroup vimrc
autocmd!
augroup END
" BEGIN TESTING NEOCOMPLETE ----------------------------------------------------------
call plug#begin('~/.vim/plugged')
Plug 'Shougo/neocomplete.vim'
call plug#end()
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_camel_case = 1
let g:neocomplete#enable_fuzzy_completion = 0
let g:neocomplete#sources#syntax#min_keyword_length = 3
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
" from the github page: <CR> cancels completion and inserts newline
inoremap <silent><CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
"return pumvisible() ? "\<C-y>" : "\<CR>"
return "\<C-y>\<CR>"
endfunction
" select completion using tab
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" re-open completion with c-space
" @see <https://github.com/Shougo/neocomplete.vim/issues/33#issuecomment-20732569>
inoremap <expr><C-Space> neocomplete#start_manual_complete('omni')
" completion
autocmd vimrc FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS

Testing vimrc

  • neocomplete.vim installed via junegunn/vim-plug
  • Configured via neocomplete.vim README.md
  1. Enter some characters, e.g. abc
  2. Go to end of line (right after letter c)
  3. Press o to open a new line after abc
  4. Press enter to insert blank line.

Expected: Blank line appears, e.g.

abc

Observed: First character of current line appears, e.g.

abc
a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment