<commit_before>" File: UltiSnips.vim
" Author: <NAME> <<EMAIL>>
" Description: The Ultimate Snippets solution for Vim
"
" Testing Info: {{{
"   See directions at the top of the test.py script located one 
"   directory above this file.
" }}}

if exists('did_UltiSnips_vim') || &cp || version < 700
    finish
endif

if !exists("g:UltiSnipsUsePythonVersion")
    let g:_uspy=":py3 "
    if !has("python3")
        if !has("python")
            echo  "UltiSnips requires py >= 2.6 or any py3"
            finish
        endif
        let g:_uspy=":py "
    endif
    let g:UltiSnipsUsePythonVersion = "<tab>"
else
    if g:UltiSnipsUsePythonVersion == 2
        let g:_uspy=":py "
    else
        let g:_uspy=":py3 "
    endif
endif

" Global Variables {{{

" The trigger used to expand a snippet.
" NOTE: expansion and forward jumping can, but needn't be the same trigger
if !exists("g:UltiSnipsExpandTrigger")
    let g:UltiSnipsExpandTrigger = "<tab>"
endif

" The trigger used to display all triggers that could possible 
" match in the current position.
if !exists("g:UltiSnipsListSnippets")
    let g:UltiSnipsListSnippets = "<c-tab>"
endif

" The trigger used to jump forward to the next placeholder. 
" NOTE: expansion and forward jumping can, but needn't be the same trigger
if !exists("g:UltiSnipsJumpForwardTrigger")
    let g:UltiSnipsJumpForwardTrigger = "<c-j>"
endif

" The trigger to jump backward inside a snippet
if !exists("g:UltiSnipsJumpBackwardTrigger")
    let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
endif

" Should UltiSnips unmap select mode mappings automagically?
if !exists("g:UltiSnipsRemoveSelectModeMappings")
    let g:UltiSnipsRemoveSelectModeMappings = 1
end

" If UltiSnips should remove Mappings, which should be ignored
if !exists("g:UltiSnipsMappingsToIgnore")
    let g:UltiSnipsMappingsToIgnore = []
endif

" UltiSnipsEdit will use this variable to decide if a new window
" is opened when editing. default is "normal", allowed are also
" "vertical", "horizontal"
if !exists("g:UltiSnipsEditSplit")
    let g:UltiSnipsEditSplit = "horizontal"
endif

" A list of directory names that are searched for snippets. 
if !exists("g:UltiSnipsSnippetDirectories")
    let g:UltiSnipsSnippetDirectories = [ "UltiSnips" ]
endif

" dir for snippets 
if !exists("g:UltiSnipsSnippetsDir")
    let g:UltiSnipsSnippetDir = [ "~/.vim/bundle/UltiSnips-2.1/UltiSnips" ]
endif

" }}}

"" Global Commands {{{
function! UltiSnipsEdit(...)
    if a:0 == 1 && a:1 != ''
        let type = a:1
    else
        exec g:_uspy "vim.command(\"let type = '%s'\" % UltiSnips_Manager.filetype)"
    endif
    exec g:_uspy "vim.command(\"let file = '%s'\" % UltiSnips_Manager.file_to_edit(vim.eval(\"type\")))"

    let mode = 'e'
    if exists('g:UltiSnipsEditSplit')
        if g:UltiSnipsEditSplit == 'vertical'
            let mode = 'vs'
        elseif g:UltiSnipsEditSplit == 'horizontal'
            let mode = 'sp'
        endif
    endif
    exe ':'.mode.' '.file
endfunction

" edit snippets, default of current file type or the specified type
command! -nargs=? UltiSnipsEdit :call UltiSnipsEdit(<q-args>)
"" }}}

"" FUNCTIONS {{{
function! CompensateForPUM()
    """ The CursorMovedI event is not triggered while the popup-menu is visible,
    """ and it's by this event that UltiSnips updates its vim-state. The fix is
    """ to explicitly check for the presence of the popup menu, and update
    """ the vim-state accordingly.
    if pumvisible()
        exec g:_uspy "UltiSnips_Manager.cursor_moved()"
    endif
endfunction
function! UltiSnips_ExpandSnippet()
    exec g:_uspy "UltiSnips_Manager.expand()"
    return ""
endfunction

function! UltiSnips_ExpandSnippetOrJump()
    call CompensateForPUM()
    exec g:_uspy "UltiSnips_Manager.expand_or_jump()"
    return ""
endfunction

function! UltiSnips_ListSnippets()
    exec g:_uspy "UltiSnips_Manager.list_snippets()"<commit_msg>create USE command that also does UltiSnipsEdit<commit_after>" File: UltiSnips.vim
" Author: <NAME> <<EMAIL>>
" Description: The Ultimate Snippets solution for Vim
"
" Testing Info: {{{
"   See directions at the top of the test.py script located one 
"   directory above this file.
" }}}

if exists('did_UltiSnips_vim') || &cp || version < 700
    finish
endif

if !exists("g:UltiSnipsUsePythonVersion")
    let g:_uspy=":py3 "
    if !has("python3")
        if !has("python")
            echo  "UltiSnips requires py >= 2.6 or any py3"
            finish
        endif
        let g:_uspy=":py "
    endif
    let g:UltiSnipsUsePythonVersion = "<tab>"
else
    if g:UltiSnipsUsePythonVersion == 2
        let g:_uspy=":py "
    else
        let g:_uspy=":py3 "
    endif
endif

" Global Variables {{{

" The trigger used to expand a snippet.
" NOTE: expansion and forward jumping can, but needn't be the same trigger
if !exists("g:UltiSnipsExpandTrigger")
    let g:UltiSnipsExpandTrigger = "<tab>"
endif

" The trigger used to display all triggers that could possible 
" match in the current position.
if !exists("g:UltiSnipsListSnippets")
    let g:UltiSnipsListSnippets = "<c-tab>"
endif

" The trigger used to jump forward to the next placeholder. 
" NOTE: expansion and forward jumping can, but needn't be the same trigger
if !exists("g:UltiSnipsJumpForwardTrigger")
    let g:UltiSnipsJumpForwardTrigger = "<c-j>"
endif

" The trigger to jump backward inside a snippet
if !exists("g:UltiSnipsJumpBackwardTrigger")
    let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
endif

" Should UltiSnips unmap select mode mappings automagically?
if !exists("g:UltiSnipsRemoveSelectModeMappings")
    let g:UltiSnipsRemoveSelectModeMappings = 1
end

" If UltiSnips should remove Mappings, which should be ignored
if !exists("g:UltiSnipsMappingsToIgnore")
    let g:UltiSnipsMappingsToIgnore = []
endif

" UltiSnipsEdit will use this variable to decide if a new window
" is opened when editing. default is "normal", allowed are also
" "vertical", "horizontal"
if !exists("g:UltiSnipsEditSplit")
    let g:UltiSnipsEditSplit = "horizontal"
endif

" A list of directory names that are searched for snippets. 
if !exists("g:UltiSnipsSnippetDirectories")
    let g:UltiSnipsSnippetDirectories = [ "UltiSnips" ]
endif

" dir for snippets 
if !exists("g:UltiSnipsSnippetsDir")
    let g:UltiSnipsSnippetDir = [ "~/.vim/bundle/UltiSnips-2.1/UltiSnips" ]
endif

" }}}

"" Global Commands {{{
function! UltiSnipsEdit(...)
    if a:0 == 1 && a:1 != ''
        let type = a:1
    else
        exec g:_uspy "vim.command(\"let type = '%s'\" % UltiSnips_Manager.filetype)"
    endif
    exec g:_uspy "vim.command(\"let file = '%s'\" % UltiSnips_Manager.file_to_edit(vim.eval(\"type\")))"

    let mode = 'e'
    if exists('g:UltiSnipsEditSplit')
        if g:UltiSnipsEditSplit == 'vertical'
            let mode = 'vs'
        elseif g:UltiSnipsEditSplit == 'horizontal'
            let mode = 'sp'
        endif
    endif
    exe ':'.mode.' '.file
endfunction

" edit snippets, default of current file type or the specified type
command! -nargs=? UltiSnipsEdit :call UltiSnipsEdit(<q-args>)
" shorter alias
command! -nargs=? USE :call UltiSnipsEdit(<q-args>)
"" }}}

"" FUNCTIONS {{{
function! CompensateForPUM()
    """ The CursorMovedI event is not triggered while the popup-menu is visible,
    """ and it's by this event that UltiSnips updates its vim-state. The fix is
    """ to explicitly check for the presence of the popup menu, and update
    """ the vim-state accordingly.
    if pumvisible()
        exec g:_uspy "UltiSnips_Manager.cursor_moved()"
    endif
endfunction
function! UltiSnips_ExpandSnippet()
    exec g:_uspy "UltiSnips_Manager.expand()"
    return ""
endfunction

function! UltiSnips_ExpandSnippetOrJump()
    call CompensateForPUM()
    exec g:_uspy "UltiSnips_Manager.expand_or_jump()"
    return ""
endfunction

function! UltiSnips_ListSnippets()
    exec g:_uspy "UltiSnips_Manager.list_snippets()"
{'fraction_non_alphanumeric': 0.10907482305358948, 'fraction_numerical': 0.004297269969666329, 'mean_word_length': 3.8103343465045594, 'pattern_counts': {'":': 8, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4811292', 'n_tokens_mistral': 2791, 'n_tokens_neox': 2607, 'n_words': 766}