|
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 |