Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.07 KB | None | 0 0
  1. imap <silent><expr><Space> <SID>SpaceExpand()
  2. imap <silent><expr><Tab> <SID>TabExpandOrJump()
  3. smap <silent><expr><Tab> <SID>TabExpandOrJump()
  4. imap <silent><expr><S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  5. imap <silent><expr><Up> pumvisible() ? "\<C-p>" : "\<Up>"
  6. imap <silent><expr><Down> pumvisible() ? "\<C-n>" : "\<Down>"
  7. imap <silent><expr><Return> pumvisible() ? deoplete#close_popup() : "\<CR>"
  8.  
  9. function! <SID>IsCommentOrString(line, col) abort
  10.     return synIDattr(synID(a:line, a:col, 0), 'name') !~ 'omment\|string' ? 1 : 0
  11. endfunction
  12.  
  13. function! <SID>TabExpandOrJump() abort
  14.     if pumvisible()
  15.         return "\<C-n>"
  16.     elseif synIDattr(synID(line('.'), col('.'), 0), 'name') !~ 'omment\|string'
  17.                 \ && neosnippet#expandable_or_jumpable()
  18.         return neosnippet#mappings#expand_impl()
  19.     endif
  20.     return "\<Tab>"
  21. endfunction
  22.  
  23. function! <SID>SpaceExpand() abort
  24.     if <SID>IsCommentOrString(line('.'), col('.')) && neosnippet#expandable()
  25.         return neosnippet#mappings#expand_impl()
  26.     endif
  27.     return "\<Space>"
  28. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement