Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible
- set backspace=indent,eol,start
- syntax on
- filetype plugin indent on
- call plug#begin('$HOME/.config/nvim/plugged')
- Plug 'sheerun/vim-polyglot' "------------ Support almost all code syntax these days
- Plug 'roxma/nvim-completion-manager'
- " Support NVIM Completion manager
- Plug 'Shougo/neosnippet'
- Plug 'Shougo/neosnippet-snippets'
- Plug 'SirVer/ultisnips'
- Plug 'othree/csscomplete.vim'
- " Snipmate
- Plug 'garbas/vim-snipmate' " Go with NCM
- Plug 'MarcWeber/vim-addon-mw-utils'
- Plug 'tomtom/tlib_vim'
- " Javascript
- Plug 'roxma/nvim-cm-tern', {'do': 'npm install'}
- " from the default language's syntax highlight file
- Plug 'Shougo/neco-syntax'
- " Typescript
- Plug 'mhartington/nvim-typescript'
- " Css, scss, sass, less
- Plug 'calebeby/ncm-css'
- " Html
- Plug 'othree/html5.vim'
- " Libraries
- Plug 'othree/javascript-libraries-syntax.vim'
- " Inclue
- Plug 'Shougo/neoinclude.vim'
- " Github
- Plug 'roxma/ncm-github'
- call plug#end()
- cd $HOME/Desktop
- " Omni
- " Enable omnicomplete for supported filetypes
- autocmd FileType css,scss setlocal omnifunc=csscomplete#CompleteCSS
- autocmd FileType html,markdown set omnifunc=htmlcomplete#CompleteTags
- " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
- " jscomplete is a separate plugin
- autocmd FileType javascript setlocal omnifunc=jscomplete#CompleteJS
- autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
- autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
- " NVim Manager
- " The minimum length of the matching word for auto
- " triggering popup menu.
- let cm_refresh_length = 1
- "Supress the annoying completion messages:
- " don't give |ins-completion-menu| messages. For example,
- " '-- XXX completion (YYY)', 'match 1 of 2', 'The only match',
- set shortmess+=c
- "When the <Enter> key is pressed while the popup menu is visible, it only hides
- "the menu. Use this mapping to hide the menu and also start a new line.
- inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
- "Here is an example for expanding snippet in the popup menu with <Enter> key.
- "Suppose you use the <C-U> key for expanding snippet.
- imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(expand_or_nl)" : "\<CR>")
- imap <expr> <Plug>(expand_or_nl) (cm#completed_is_snippet() ? "\<C-U>":"\<CR>")
- "Use <TAB> to select the popup menu:
- inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
- inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
- " register source for NCM.
- " Css in html
- " css completion via `csscomplete#CompleteCSS`
- " The `'cm_refresh_patterns'` is PCRE.
- " Be careful with `'scoping': 1` here, not all sources, especially omnifunc,
- " can handle this feature properly.
- au User CmSetup call cm#register_source({'name' : 'cm-css',
- \ 'priority': 9,
- \ 'scoping': 1,
- \ 'scopes': ['css','scss'],
- \ 'abbreviation': 'css',
- \ 'word_pattern': '[\w\-]+',
- \ 'cm_refresh_patterns':['[\w\-]+\s*:\s+'],
- \ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
- \ })
- " Html
- au User CmSetup call cm#register_source({'name' : 'cm-html',
- \ 'priority': 9,
- \ 'scopes': ['html'],
- \ 'scoping': 1,
- \ 'abbreviation': 'html',
- \ 'cm_refresh_patterns':['\w{2,}$',':\s+\w*$'],
- \ 'cm_refresh': {'omnifunc': 'htmlcomplete#CompleteTags'},
- \ })
- " Other
- let g:neosnippet#enable_snipmate_compatibility = 1
- " Tell Neosnippet about the other snippets
- " let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
- " Ultisnip
- let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
- let g:UltiSnipsJumpForwardTrigger = "<c-j>"
- let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
- let g:UltiSnipsRemoveSelectModeMappings = 0
- " optional
- inoremap <silent> <c-u> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>
- " Snipmate
- let g:snips_no_mappings = 1
- " imap <expr> <c-u> pumvisible() ? "\<c-y>\<Plug>snipMateTrigger" : "\<Plug>snipMateTrigger"
- " wrap the mapping
- imap <expr> <Plug>(snipmate_force_trigger) pumvisible() ? "\<c-y>\<Plug>snipMateTrigger" : "\<Plug>snipMateTrigger"
- " show a list of snippets when no the user has typed nothing
- inoremap <silent> <c-u> <c-r>=cm#sources#snipmate#trigger_or_popup("\<Plug>(snipmate_force_trigger)")<cr>
- vmap <c-u> <Plug>snipMateTrigger
- imap <expr> <c-j> pumvisible() ? "\<c-y>\<Plug>snipMateNextOrTrigger" : "\<Plug>snipMateNextOrTrigger"
- vmap <c-j> <Plug>snipMateNextOrTrigger
- imap <expr> <c-k> pumvisible() ? "\<c-y>\<Plug>snipMateBack" : "\<Plug>snipMateBack"
- vmap <c-k> <Plug>snipMateBack
- "Neo snippet
- imap <c-j> <Plug>(neosnippet_expand_or_jump)
- vmap <c-j> <Plug>(neosnippet_expand_or_jump)
- inoremap <silent> <c-u> <c-r>=cm#sources#neosnippet#trigger_or_popup("\<Plug>(neosnippet_expand_or_jump)")<cr>
- vmap <c-u> <Plug>(neosnippet_expand_target)
- " expand parameters
- let g:neosnippet#enable_completed_snippet=1
- let g:cm_completeopt = "menu,menuone,noinsert,noselect"
Add Comment
Please, Sign In to add comment