Guest User

Untitled

a guest
Feb 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.23 KB | None | 0 0
  1. set nocompatible
  2. set backspace=indent,eol,start
  3. syntax on
  4.  
  5. filetype plugin indent on
  6.  
  7. call plug#begin('$HOME/.config/nvim/plugged')
  8.  
  9. Plug 'sheerun/vim-polyglot' "------------ Support almost all code syntax these days
  10.  
  11.  
  12. Plug 'roxma/nvim-completion-manager'
  13. " Support NVIM Completion manager
  14. Plug 'Shougo/neosnippet'
  15. Plug 'Shougo/neosnippet-snippets'
  16. Plug 'SirVer/ultisnips'
  17. Plug 'othree/csscomplete.vim'
  18.  
  19. " Snipmate
  20. Plug 'garbas/vim-snipmate' " Go with NCM
  21. Plug 'MarcWeber/vim-addon-mw-utils'
  22. Plug 'tomtom/tlib_vim'
  23.  
  24. " Javascript
  25. Plug 'roxma/nvim-cm-tern', {'do': 'npm install'}
  26.  
  27. " from the default language's syntax highlight file
  28. Plug 'Shougo/neco-syntax'
  29.  
  30. " Typescript
  31. Plug 'mhartington/nvim-typescript'
  32.  
  33. " Css, scss, sass, less
  34. Plug 'calebeby/ncm-css'
  35.  
  36. " Html
  37. Plug 'othree/html5.vim'
  38.  
  39. " Libraries
  40. Plug 'othree/javascript-libraries-syntax.vim'
  41.  
  42.  
  43. " Inclue
  44. Plug 'Shougo/neoinclude.vim'
  45.  
  46. " Github
  47. Plug 'roxma/ncm-github'
  48.  
  49. call plug#end()
  50.  
  51.  
  52. cd $HOME/Desktop
  53.  
  54. " Omni
  55.  
  56. " Enable omnicomplete for supported filetypes
  57. autocmd FileType css,scss setlocal omnifunc=csscomplete#CompleteCSS
  58. autocmd FileType html,markdown set omnifunc=htmlcomplete#CompleteTags
  59. " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  60. " jscomplete is a separate plugin
  61. autocmd FileType javascript setlocal omnifunc=jscomplete#CompleteJS
  62. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  63. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  64.  
  65. " NVim Manager
  66. " The minimum length of the matching word for auto
  67. " triggering popup menu.
  68.  
  69. let cm_refresh_length = 1
  70.  
  71.  
  72. "Supress the annoying completion messages:
  73.  
  74. " don't give |ins-completion-menu| messages. For example,
  75. " '-- XXX completion (YYY)', 'match 1 of 2', 'The only match',
  76. set shortmess+=c
  77.  
  78. "When the <Enter> key is pressed while the popup menu is visible, it only hides
  79. "the menu. Use this mapping to hide the menu and also start a new line.
  80.  
  81. inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
  82.  
  83. "Here is an example for expanding snippet in the popup menu with <Enter> key.
  84. "Suppose you use the <C-U> key for expanding snippet.
  85.  
  86. imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(expand_or_nl)" : "\<CR>")
  87. imap <expr> <Plug>(expand_or_nl) (cm#completed_is_snippet() ? "\<C-U>":"\<CR>")
  88.  
  89. "Use <TAB> to select the popup menu:
  90.  
  91. inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  92. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  93.  
  94. " register source for NCM.
  95. " Css in html
  96. " css completion via `csscomplete#CompleteCSS`
  97. " The `'cm_refresh_patterns'` is PCRE.
  98. " Be careful with `'scoping': 1` here, not all sources, especially omnifunc,
  99. " can handle this feature properly.
  100. au User CmSetup call cm#register_source({'name' : 'cm-css',
  101. \ 'priority': 9,
  102. \ 'scoping': 1,
  103. \ 'scopes': ['css','scss'],
  104. \ 'abbreviation': 'css',
  105. \ 'word_pattern': '[\w\-]+',
  106. \ 'cm_refresh_patterns':['[\w\-]+\s*:\s+'],
  107. \ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
  108. \ })
  109.  
  110. " Html
  111. au User CmSetup call cm#register_source({'name' : 'cm-html',
  112. \ 'priority': 9,
  113. \ 'scopes': ['html'],
  114. \ 'scoping': 1,
  115. \ 'abbreviation': 'html',
  116. \ 'cm_refresh_patterns':['\w{2,}$',':\s+\w*$'],
  117. \ 'cm_refresh': {'omnifunc': 'htmlcomplete#CompleteTags'},
  118. \ })
  119.  
  120.  
  121. " Other
  122. let g:neosnippet#enable_snipmate_compatibility = 1
  123. " Tell Neosnippet about the other snippets
  124. " let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
  125.  
  126. " Ultisnip
  127. let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
  128. let g:UltiSnipsJumpForwardTrigger = "<c-j>"
  129. let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
  130. let g:UltiSnipsRemoveSelectModeMappings = 0
  131. " optional
  132. inoremap <silent> <c-u> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>
  133.  
  134. " Snipmate
  135. let g:snips_no_mappings = 1
  136. " imap <expr> <c-u> pumvisible() ? "\<c-y>\<Plug>snipMateTrigger" : "\<Plug>snipMateTrigger"
  137. " wrap the mapping
  138. imap <expr> <Plug>(snipmate_force_trigger) pumvisible() ? "\<c-y>\<Plug>snipMateTrigger" : "\<Plug>snipMateTrigger"
  139. " show a list of snippets when no the user has typed nothing
  140. inoremap <silent> <c-u> <c-r>=cm#sources#snipmate#trigger_or_popup("\<Plug>(snipmate_force_trigger)")<cr>
  141. vmap <c-u> <Plug>snipMateTrigger
  142. imap <expr> <c-j> pumvisible() ? "\<c-y>\<Plug>snipMateNextOrTrigger" : "\<Plug>snipMateNextOrTrigger"
  143. vmap <c-j> <Plug>snipMateNextOrTrigger
  144. imap <expr> <c-k> pumvisible() ? "\<c-y>\<Plug>snipMateBack" : "\<Plug>snipMateBack"
  145. vmap <c-k> <Plug>snipMateBack
  146.  
  147. "Neo snippet
  148. imap <c-j> <Plug>(neosnippet_expand_or_jump)
  149. vmap <c-j> <Plug>(neosnippet_expand_or_jump)
  150. inoremap <silent> <c-u> <c-r>=cm#sources#neosnippet#trigger_or_popup("\<Plug>(neosnippet_expand_or_jump)")<cr>
  151. vmap <c-u> <Plug>(neosnippet_expand_target)
  152. " expand parameters
  153. let g:neosnippet#enable_completed_snippet=1
  154.  
  155. let g:cm_completeopt = "menu,menuone,noinsert,noselect"
Add Comment
Please, Sign In to add comment