Some checks failed
		
		
	
	Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
				
			Detach Plugins / check (GitHub.vim) (push) Has been cancelled
				
			Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
				
			Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
				
			Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
				
			Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
				
			Detach Plugins / check (git.vim) (push) Has been cancelled
				
			Detach Plugins / check (iedit.vim) (push) Has been cancelled
				
			Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
				
			Detach Plugins / check (vim-chat) (push) Has been cancelled
				
			Detach Plugins / check (vim-cheat) (push) Has been cancelled
				
			Detach Plugins / check (vim-todo) (push) Has been cancelled
				
			Detach Plugins / check (xmake.vim) (push) Has been cancelled
				
			test / Linux (nvim, nightly) (push) Has been cancelled
				
			test / Linux (nvim, v0.3.8) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.2) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.3) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.4) (push) Has been cancelled
				
			test / Linux (nvim, v0.5.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.5.1) (push) Has been cancelled
				
			test / Linux (nvim, v0.6.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.6.1) (push) Has been cancelled
				
			test / Linux (nvim, v0.7.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.7.2) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.1) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.2) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.3) (push) Has been cancelled
				
			test / Linux (nvim, v0.9.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.9.1) (push) Has been cancelled
				
			test / Linux (true, vim, v7.4.052) (push) Has been cancelled
				
			test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
				
			test / Linux (true, vim, v7.4.629) (push) Has been cancelled
				
			test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
				
			test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
				
			test / Linux (vim, nightly) (push) Has been cancelled
				
			test / Linux (vim, v8.0.0184) (push) Has been cancelled
				
			test / Linux (vim, v8.0.1453) (push) Has been cancelled
				
			test / Linux (vim, v8.1.2269) (push) Has been cancelled
				
			test / Linux (vim, v8.2.2434) (push) Has been cancelled
				
			test / Linux (vim, v8.2.3995) (push) Has been cancelled
				
			test / Windows (nvim, nightly) (push) Has been cancelled
				
			test / Windows (nvim, v0.3.8) (push) Has been cancelled
				
			test / Windows (nvim, v0.4.2) (push) Has been cancelled
				
			test / Windows (nvim, v0.4.3) (push) Has been cancelled
				
			test / Windows (nvim, v0.4.4) (push) Has been cancelled
				
			test / Windows (nvim, v0.5.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.5.1) (push) Has been cancelled
				
			test / Windows (nvim, v0.6.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.6.1) (push) Has been cancelled
				
			test / Windows (nvim, v0.7.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.7.2) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.1) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.2) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.3) (push) Has been cancelled
				
			test / Windows (nvim, v0.9.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.9.1) (push) Has been cancelled
				
			test / Windows (vim, nightly) (push) Has been cancelled
				
			test / Windows (vim, v7.4.1185) (push) Has been cancelled
				
			test / Windows (vim, v7.4.1689) (push) Has been cancelled
				
			test / Windows (vim, v8.0.0027) (push) Has been cancelled
				
			test / Windows (vim, v8.0.1453) (push) Has been cancelled
				
			test / Windows (vim, v8.1.2269) (push) Has been cancelled
				
			test / Windows (vim, v8.2.2434) (push) Has been cancelled
				
			test / Windows (vim, v8.2.3995) (push) Has been cancelled
				
			docker / docker (push) Has been cancelled
				
			mirror / check (coding) (push) Has been cancelled
				
			mirror / check (gitee) (push) Has been cancelled
				
			mirror / check (gitlab) (push) Has been cancelled
				
			
		
			
				
	
	
		
			307 lines
		
	
	
		
			9.3 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
			
		
		
	
	
			307 lines
		
	
	
		
			9.3 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
"=============================================================================
 | 
						|
" FILE: mappings.vim
 | 
						|
" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
 | 
						|
" License: MIT license
 | 
						|
"=============================================================================
 | 
						|
 | 
						|
function! neosnippet#mappings#expandable_or_jumpable() abort
 | 
						|
  return neosnippet#mappings#expandable() || neosnippet#mappings#jumpable()
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#expandable() abort
 | 
						|
  " Check snippet trigger.
 | 
						|
  return neosnippet#mappings#completed_expandable()
 | 
						|
        \ || neosnippet#helpers#get_cursor_snippet(
 | 
						|
        \      neosnippet#helpers#get_snippets('i'),
 | 
						|
        \      neosnippet#util#get_cur_text()) !=# ''
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#jumpable() abort
 | 
						|
  " Found snippet placeholder.
 | 
						|
  return search(neosnippet#get_placeholder_marker_pattern(). '\|'
 | 
						|
            \ .neosnippet#get_sync_placeholder_marker_pattern(), 'nw') > 0
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#completed_expandable() abort
 | 
						|
  if empty(get(v:, 'completed_item', {}))
 | 
						|
    return 0
 | 
						|
  endif
 | 
						|
 | 
						|
  return !empty(s:get_completed_snippets(
 | 
						|
        \ neosnippet#util#get_cur_text(), col('.')))
 | 
						|
endfunction
 | 
						|
 | 
						|
function! neosnippet#mappings#_clear_select_mode_mappings() abort
 | 
						|
  if !g:neosnippet#disable_select_mode_mappings || !exists('*execute')
 | 
						|
    return
 | 
						|
  endif
 | 
						|
 | 
						|
  let mappings = execute('smap', 'silent!')
 | 
						|
 | 
						|
  for map in map(filter(split(mappings, '\n'),
 | 
						|
        \ "v:val !~# '^s' && v:val !~# '^\\a*\\s*<\\S\\+>'"),
 | 
						|
        \ "matchstr(v:val, '^\\a*\\s*\\zs\\S\\+')")
 | 
						|
    silent! execute 'sunmap' map
 | 
						|
    silent! execute 'sunmap <buffer>' map
 | 
						|
  endfor
 | 
						|
 | 
						|
  " Define default select mode mappings.
 | 
						|
  snoremap <CR>     a<BS>
 | 
						|
  snoremap <BS>     a<BS>
 | 
						|
  snoremap <Del>    a<BS>
 | 
						|
  snoremap <C-h>    a<BS>
 | 
						|
endfunction
 | 
						|
 | 
						|
function! neosnippet#mappings#_register_oneshot_snippet() abort
 | 
						|
  let trigger = input('Please input snippet trigger: ', 'oneshot')
 | 
						|
  if trigger ==# ''
 | 
						|
    return
 | 
						|
  endif
 | 
						|
 | 
						|
  let selected_text = substitute(
 | 
						|
        \ neosnippet#helpers#get_selected_text(visualmode(), 1), '\n$', '', '')
 | 
						|
  call neosnippet#helpers#delete_selected_text(visualmode(), 1)
 | 
						|
 | 
						|
  let base_indent = matchstr(selected_text, '^\s*')
 | 
						|
 | 
						|
  " Delete base_indent.
 | 
						|
  let selected_text = substitute(selected_text,
 | 
						|
        \'^' . base_indent, '', 'g')
 | 
						|
 | 
						|
  let neosnippet = neosnippet#variables#current_neosnippet()
 | 
						|
  let options = neosnippet#parser#_initialize_snippet_options()
 | 
						|
  let options.word = 1
 | 
						|
  let options.oneshot = 1
 | 
						|
 | 
						|
  let neosnippet.snippets[trigger] = neosnippet#parser#_initialize_snippet(
 | 
						|
        \ { 'name' : trigger, 'word' : selected_text, 'options' : options },
 | 
						|
        \ '', 0, '', trigger)
 | 
						|
 | 
						|
  echo 'Registered trigger : ' . trigger
 | 
						|
endfunction
 | 
						|
 | 
						|
function! neosnippet#mappings#_expand_target() abort
 | 
						|
  let trigger = input('Please input snippet trigger: ',
 | 
						|
        \ '', 'customlist,neosnippet#commands#_complete_target_snippets')
 | 
						|
  let neosnippet = neosnippet#variables#current_neosnippet()
 | 
						|
  if !has_key(neosnippet#helpers#get_snippets('i'), trigger) ||
 | 
						|
        \ neosnippet#helpers#get_snippets('i')[trigger].snip !~#
 | 
						|
        \   neosnippet#get_placeholder_target_marker_pattern()
 | 
						|
    if trigger !=# ''
 | 
						|
      echo 'The trigger is invalid.'
 | 
						|
    endif
 | 
						|
 | 
						|
    let neosnippet.target = ''
 | 
						|
    return
 | 
						|
  endif
 | 
						|
 | 
						|
  call neosnippet#mappings#_expand_target_trigger(trigger)
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#_expand_target_trigger(trigger) abort
 | 
						|
  let neosnippet = neosnippet#variables#current_neosnippet()
 | 
						|
  let neosnippet.target = substitute(
 | 
						|
        \ neosnippet#helpers#get_selected_text(visualmode(), 1), '\n$', '', '')
 | 
						|
 | 
						|
  let line = getpos("'<")[1]
 | 
						|
  let col = getpos("'<")[2]
 | 
						|
 | 
						|
  call neosnippet#helpers#delete_selected_text(visualmode())
 | 
						|
 | 
						|
  call cursor(line, col)
 | 
						|
 | 
						|
  if col == 1
 | 
						|
    let cur_text = a:trigger
 | 
						|
  else
 | 
						|
    let cur_text = neosnippet#util#get_cur_text()
 | 
						|
    let cur_text = cur_text[: col-2] . a:trigger
 | 
						|
  endif
 | 
						|
 | 
						|
  call neosnippet#view#_expand(cur_text, col, a:trigger)
 | 
						|
 | 
						|
  if !neosnippet#mappings#jumpable()
 | 
						|
    call cursor(0, col('.') - 1)
 | 
						|
    stopinsert
 | 
						|
  endif
 | 
						|
endfunction
 | 
						|
 | 
						|
function! neosnippet#mappings#_anonymous(snippet) abort
 | 
						|
  let [cur_text, col, expr] = neosnippet#mappings#_pre_trigger()
 | 
						|
  let expr .= printf("\<C-c>:call neosnippet#view#_insert(%s, {}, %s, %d)\<CR>",
 | 
						|
        \ string(a:snippet), string(cur_text), col)
 | 
						|
 | 
						|
  return expr
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#_expand(trigger) abort
 | 
						|
  let [cur_text, col, expr] = neosnippet#mappings#_pre_trigger()
 | 
						|
 | 
						|
  let expr .= printf("\<C-c>:call neosnippet#view#_expand(%s, %d, %s)\<CR>",
 | 
						|
        \ string(cur_text), col, string(a:trigger))
 | 
						|
 | 
						|
  return expr
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:snippets_expand(cur_text, col) abort
 | 
						|
  let cur_word = neosnippet#helpers#get_cursor_snippet(
 | 
						|
        \ neosnippet#helpers#get_snippets('i'),
 | 
						|
        \ a:cur_text)
 | 
						|
  if cur_word !=# ''
 | 
						|
    " Found snippet trigger.
 | 
						|
    call neosnippet#view#_expand(
 | 
						|
          \ neosnippet#util#get_cur_text(), a:col, cur_word)
 | 
						|
    return 0
 | 
						|
  endif
 | 
						|
 | 
						|
  return 1
 | 
						|
endfunction
 | 
						|
function! s:get_completed_snippets(cur_text, col) abort
 | 
						|
  let completed_item = neosnippet#util#get_completed_item()
 | 
						|
  if empty(completed_item)
 | 
						|
    return []
 | 
						|
  endif
 | 
						|
 | 
						|
  if has_key(completed_item, 'user_data')
 | 
						|
    let ret = s:get_user_data(a:cur_text)
 | 
						|
    if !empty(ret)
 | 
						|
      return [ret[0], ret[1], ret[2]]
 | 
						|
    endif
 | 
						|
  endif
 | 
						|
 | 
						|
  if g:neosnippet#enable_completed_snippet
 | 
						|
    let snippet = neosnippet#parser#_get_completed_snippet(
 | 
						|
          \ completed_item, a:cur_text, neosnippet#util#get_next_text())
 | 
						|
    if snippet !=# ''
 | 
						|
      return [a:cur_text, snippet, {}]
 | 
						|
    endif
 | 
						|
  endif
 | 
						|
 | 
						|
  return []
 | 
						|
endfunction
 | 
						|
function! s:get_user_data(cur_text) abort
 | 
						|
  let completed_item = neosnippet#util#get_completed_item()
 | 
						|
  let user_data = neosnippet#helpers#get_user_data(completed_item)
 | 
						|
  if type(completed_item.user_data) ==# v:t_dict
 | 
						|
    let user_data = completed_item.user_data
 | 
						|
  else
 | 
						|
    silent! let user_data = json_decode(completed_item.user_data)
 | 
						|
  endif
 | 
						|
  if type(user_data) !=# v:t_dict || empty(user_data)
 | 
						|
    return []
 | 
						|
  endif
 | 
						|
 | 
						|
  let cur_text = a:cur_text
 | 
						|
  let snippet = ''
 | 
						|
  let snippet_trigger = completed_item.word
 | 
						|
 | 
						|
  let lspitem = neosnippet#helpers#get_lspitem(user_data)
 | 
						|
  let has_lspitem = v:false
 | 
						|
 | 
						|
  if !empty(lspitem)
 | 
						|
    if has_key(lspitem, 'textEdit') && type(lspitem.textEdit) == v:t_dict
 | 
						|
      let snippet = lspitem.textEdit.newText
 | 
						|
      let has_lspitem = v:true
 | 
						|
    elseif get(lspitem, 'insertTextFormat', -1) == 2
 | 
						|
      let snippet = get(lspitem, 'insertText', lspitem.label)
 | 
						|
      let has_lspitem = v:true
 | 
						|
    endif
 | 
						|
  elseif get(user_data, 'snippet', '') !=# ''
 | 
						|
    let snippet = user_data.snippet
 | 
						|
  endif
 | 
						|
 | 
						|
  if snippet ==# ''
 | 
						|
    return []
 | 
						|
  endif
 | 
						|
 | 
						|
  " Substitute $0, $1, $2,... to ${0}, ${1}, ${2}...
 | 
						|
  let snippet = substitute(snippet, '\$\(\d\+\)', '${\1}', 'g')
 | 
						|
 | 
						|
  let cur_text = cur_text[: -1-len(snippet_trigger)]
 | 
						|
  return [cur_text, snippet, {'lspitem': has_lspitem}]
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#_complete_done(cur_text, col) abort
 | 
						|
  let ret = s:get_completed_snippets(a:cur_text, a:col)
 | 
						|
  if empty(ret)
 | 
						|
    return 0
 | 
						|
  endif
 | 
						|
 | 
						|
  let [cur_text, snippet, options] = ret
 | 
						|
  call neosnippet#view#_insert(snippet, options, cur_text, a:col)
 | 
						|
  return 1
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:snippets_expand_or_jump(cur_text, col) abort
 | 
						|
  if s:snippets_expand(a:cur_text, a:col)
 | 
						|
    call neosnippet#view#_jump('', a:col)
 | 
						|
  endif
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:snippets_jump_or_expand(cur_text, col) abort
 | 
						|
  if search(neosnippet#get_placeholder_marker_pattern(). '\|'
 | 
						|
            \ .neosnippet#get_sync_placeholder_marker_pattern(), 'nw') > 0
 | 
						|
    " Found snippet placeholder.
 | 
						|
    call neosnippet#view#_jump('', a:col)
 | 
						|
  else
 | 
						|
    return s:snippets_expand(a:cur_text, a:col)
 | 
						|
  endif
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:SID_PREFIX() abort
 | 
						|
  return matchstr(expand('<sfile>'), '<SNR>\d\+_\ze\w\+$')
 | 
						|
endfunction
 | 
						|
 | 
						|
function! neosnippet#mappings#_trigger(function) abort
 | 
						|
  if g:neosnippet#enable_complete_done && pumvisible()
 | 
						|
        \ && neosnippet#mappings#expandable()
 | 
						|
      return ''
 | 
						|
  endif
 | 
						|
 | 
						|
  if !neosnippet#mappings#expandable_or_jumpable()
 | 
						|
    return ''
 | 
						|
  endif
 | 
						|
 | 
						|
  let [cur_text, col, expr] = neosnippet#mappings#_pre_trigger()
 | 
						|
 | 
						|
  let expr .= printf("\<C-c>:call %s(%s,%d)\<CR>",
 | 
						|
        \ a:function, string(cur_text), col)
 | 
						|
 | 
						|
  return expr
 | 
						|
endfunction
 | 
						|
 | 
						|
function! neosnippet#mappings#_pre_trigger() abort
 | 
						|
  call neosnippet#init#check()
 | 
						|
 | 
						|
  let cur_text = neosnippet#util#get_cur_text()
 | 
						|
 | 
						|
  let col = col('.')
 | 
						|
  let expr = ''
 | 
						|
  if mode() !=# 'i'
 | 
						|
    " Fix column.
 | 
						|
    let col += 2
 | 
						|
  endif
 | 
						|
 | 
						|
  " Get selected text.
 | 
						|
  let neosnippet = neosnippet#variables#current_neosnippet()
 | 
						|
  let neosnippet.trigger = 1
 | 
						|
  if mode() ==# 's' && neosnippet.optional_tabstop
 | 
						|
    let expr .= "\<C-o>\"_d"
 | 
						|
  endif
 | 
						|
 | 
						|
  return [cur_text, col, expr]
 | 
						|
endfunction
 | 
						|
 | 
						|
" Plugin key-mappings.
 | 
						|
function! neosnippet#mappings#expand_or_jump_impl() abort
 | 
						|
  return mode() ==# 's' ?
 | 
						|
        \ neosnippet#mappings#_trigger('neosnippet#view#_jump') :
 | 
						|
        \ neosnippet#mappings#_trigger(
 | 
						|
        \   s:SID_PREFIX().'snippets_expand_or_jump')
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#jump_or_expand_impl() abort
 | 
						|
  return mode() ==# 's' ?
 | 
						|
        \ neosnippet#mappings#_trigger('neosnippet#view#_jump') :
 | 
						|
        \ neosnippet#mappings#_trigger(
 | 
						|
        \   s:SID_PREFIX().'snippets_jump_or_expand')
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#expand_impl() abort
 | 
						|
  return neosnippet#mappings#_trigger(s:SID_PREFIX().'snippets_expand')
 | 
						|
endfunction
 | 
						|
function! neosnippet#mappings#jump_impl() abort
 | 
						|
  return neosnippet#mappings#_trigger('neosnippet#view#_jump')
 | 
						|
endfunction
 |