<commit_before>scriptencoding 'utf-8'
" Tools Setttings
" github.com/mike325/.vim

let s:gitversion = ''
let s:moderngit = -1

" Extracted from tpop's Fugitive plugin
function! tools#GitVersion(...) abort
    if !executable('git')
        return 0
    endif

    if empty(s:gitversion)
        let s:gitversion = matchstr(system('git --version'), "\\S\\+\\ze\n")
    endif

    let l:version = s:gitversion

    if !a:0
        return l:version
    endif

    let l:components = split(l:version, '\D\+')

    for l:i in range(len(a:000))
        if a:000[l:i] > +get(l:components, l:i)
            return 0
        elseif a:000[l:i] < +get(l:components, l:i)
            return 1
        endif
    endfor
    return a:000[l:i] ==# get(l:components, l:i)
endfunction

if has('nvim-0.4')
    function! tools#createFloatingBuffer(...) abort
        let buf = nvim_create_buf(0, 1)
        call setbufvar(buf, '&signcolumn', 'no')

        let l:height = (a:0 > 0) ? a:1 : float2nr(&lines / 2)
        let l:width  = (a:0 > 1) ? a:2 : float2nr(&columns - (&columns * 2 / 10))
        let l:col    = (a:0 > 2) ? a:3 : float2nr((&columns - l:width) / 2)

        let l:opts = {
            \ 'style'   : 'minimal',
            \ 'relative': 'editor',
            \ 'row'     : 4,
            \ 'col'     : l:col,
            \ 'width'   : l:width,
            \ 'height'  : l:height
            \ }

        call nvim_open_win(buf, 1, l:opts)
        return buf
    endfunction
endif

function! tools#getLanguageServer(language) abort
    if ! tools#CheckLanguageServer(a:language)
        return []
    endif

    let l:langservers = {
        \ 'python': ['pyls'],
        \ 'c'     : ['ccls', 'clangd', 'cquery'],
        \ 'cpp'   : ['ccls', 'clangd', 'cquery'],
        \ 'cuda'  : ['ccls'],
        \ 'objc'  : ['ccls'],
        \ 'sh'    : ['bash-language-server'],
        \ 'bash'  : ['bash-language-server'],
        \ 'go'    : ['gopls'],
        \ }
    let l:cmds = {
        \ 'pyls'   : ['pyls', '--log-file=' . os#tmp('pyls.log')],
        \ 'ccls'   : ['ccls',
        \             '--log-file=' . os#tmp('ccls.log'),
        \             '--init={"cacheDirectory":"' . os#cache() . '/ccls", "completion": {"filterAndSort": false}}'],
        \ 'cquery' : ['cquery',
        \             '--log-file=' . os#tmp('cquery.log'),
        \             '--init={"cacheDirectory":"' . os#cache() . '/cquery", "completion": {"filterAndSort": false}}'],
        \ 'clangd' : ['clangd', '-index'],
        \ 'gopls'  : ['gopls'],
        \ 'bash-language-server': ['bash-language-server', 'start'],
        \ }
    let l:servers = l:langservers[a:language]<commit_msg>feat!: Change clangd args<commit_after>scriptencoding 'utf-8'
" Tools Setttings
" github.com/mike325/.vim

let s:gitversion = ''
let s:moderngit = -1

" Extracted from tpop's Fugitive plugin
function! tools#GitVersion(...) abort
    if !executable('git')
        return 0
    endif

    if empty(s:gitversion)
        let s:gitversion = matchstr(system('git --version'), "\\S\\+\\ze\n")
    endif

    let l:version = s:gitversion

    if !a:0
        return l:version
    endif

    let l:components = split(l:version, '\D\+')

    for l:i in range(len(a:000))
        if a:000[l:i] > +get(l:components, l:i)
            return 0
        elseif a:000[l:i] < +get(l:components, l:i)
            return 1
        endif
    endfor
    return a:000[l:i] ==# get(l:components, l:i)
endfunction

if has('nvim-0.4')
    function! tools#createFloatingBuffer(...) abort
        let buf = nvim_create_buf(0, 1)
        call setbufvar(buf, '&signcolumn', 'no')

        let l:height = (a:0 > 0) ? a:1 : float2nr(&lines / 2)
        let l:width  = (a:0 > 1) ? a:2 : float2nr(&columns - (&columns * 2 / 10))
        let l:col    = (a:0 > 2) ? a:3 : float2nr((&columns - l:width) / 2)

        let l:opts = {
            \ 'style'   : 'minimal',
            \ 'relative': 'editor',
            \ 'row'     : 4,
            \ 'col'     : l:col,
            \ 'width'   : l:width,
            \ 'height'  : l:height
            \ }

        call nvim_open_win(buf, 1, l:opts)
        return buf
    endfunction
endif

function! tools#getLanguageServer(language) abort
    if ! tools#CheckLanguageServer(a:language)
        return []
    endif

    let l:langservers = {
        \ 'python': ['pyls'],
        \ 'c'     : ['ccls', 'clangd', 'cquery'],
        \ 'cpp'   : ['ccls', 'clangd', 'cquery'],
        \ 'cuda'  : ['ccls'],
        \ 'objc'  : ['ccls'],
        \ 'sh'    : ['bash-language-server'],
        \ 'bash'  : ['bash-language-server'],
        \ 'go'    : ['gopls'],
        \ }
    let l:cmds = {
        \ 'pyls'   : ['pyls', '--log-file=' . os#tmp('pyls.log')],
        \ 'ccls'   : ['ccls',
        \             '--log-file=' . os#tmp('ccls.log'),
        \             '--init={"cacheDirectory":"' . os#cache() . '/ccls", "completion": {"filterAndSort": false}}'],
        \ 'cquery' : ['cquery',
        \             '--log-file=' . os#tmp('cquery.log'),
        \             '--init={"cacheDirectory":"' . os#cache() . '/cquery", "completion": {"filterAndSort": false}}'],
        \ 'clangd' : ['clangd', '-background-index'],
        \ 'gopls'  : ['gopls'],
        \ 'bash-language-server': ['bash-language-server', 'start'],
        \ }
    let l:servers = l:langservers[a:language]
{'fraction_non_alphanumeric': 0.19426336375488917, 'fraction_numerical': 0.016390389271745204, 'mean_word_length': 1.8701229289150187, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 11, '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': '7105000', 'n_tokens_mistral': 2005, 'n_tokens_neox': 1916, 'n_words': 384}