<commit_before>if !has('nvim')
    finish
endif

" completion-nvim
let g:completion_enable_snippet = 'vim-vsnip'
let g:completion_matching_ignore_case = 1
let g:completion_auto_change_source = 1

let g:completion_chain_complete_list = {
    \ 'default' : {
    \   'default': [
    \     {'complete_items': ['lsp', 'snippet', 'buffers', 'path']},
    \     {'mode': '<c-p>'},
    \     {'mode': '<c-n>'}
    \   ]
    \ },
    \ 'python': [
    \     {'complete_items': ['ts', 'lsp', 'snippet', 'buffers', 'path']},
    \     {'mode': '<c-p>'},
    \     {'mode': '<c-n>'}
    \ ]
    \ }

augroup MyAutoCmd
    autocmd BufEnter * lua require'completion'.on_attach()
augroup END

inoremap <silent><expr> <c-n> completion#trigger_completion()

" completion-buffers
let g:completion_word_min_length = 1

" nvim-treesitter
" TSInstall python
" TSInstallInfo

" nvim-lsp
lua require'nvim_lsp'.pyls.setup{}
"lua require'nvim_lsp'.jedi_language_server.setup{}

nnoremap <silent> 1gD       <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> <Leader>[ <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> <Leader>] <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> <Leader>k <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> <Leader>s <cmd>lua vim.lsp.buf.document_symbol()<CR>
nnoremap <silent> <Leader>z <cmd>lua vim.lsp.buf.formatting()<CR>
nnoremap <silent> <Leader>K <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> gD        <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <silent> gW        <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
nnoremap <silent> gd        <cmd>lua vim.lsp.buf.declaration()<CR>
xnoremap <silent> <Leader>z <cmd>lua vim.lsp.buf.formatting()<CR>

" diagnostic-nvim
nnoremap <silent> <Leader>d :<C-u>OpenDiagnostic<CR>
nnoremap <silent> <Leader>n :<C-u>NextDiagnosticCycle<CR>
nnoremap <silent> <Leader>p :<C-u>PrevDiagnosticCycle<CR><commit_msg>update lsp settings<commit_after>if !has('nvim')
    finish
endif

" completion-nvim
let g:completion_enable_snippet = 'vim-vsnip'
let g:completion_matching_ignore_case = 1
let g:completion_auto_change_source = 1

let g:completion_chain_complete_list = {
    \ 'default' : {
    \   'default': [
    \     {'complete_items': ['lsp', 'snippet', 'buffers', 'path']},
    \     {'mode': '<c-p>'},
    \     {'mode': '<c-n>'}
    \   ]
    \ },
    \ 'python': [
    \     {'complete_items': ['ts', 'lsp', 'snippet', 'buffers', 'path']},
    \     {'mode': '<c-p>'},
    \     {'mode': '<c-n>'}
    \ ]
    \ }

augroup MyAutoCmd
    autocmd BufEnter * lua require'completion'.on_attach()
augroup END

inoremap <silent><expr> <c-n> completion#trigger_completion()

" completion-buffers
let g:completion_word_min_length = 1

" nvim-treesitter
" TSInstall python
" TSInstallInfo

" nvim-lsp
lua <<EOF
local on_attach_vim = function()
    require'completion'.on_attach()
    require'diagnostic'.on_attach()
end

local nvim_lsp = require'nvim_lsp'
nvim_lsp.bashls.setup{on_attach=on_attach_vim}
nvim_lsp.diagnosticls.setup{on_attach=on_attach_vim}
nvim_lsp.dockerls.setup{on_attach=on_attach_vim}
-- nvim_lsp.jedi_language_server.setup{on_attach=on_attach_vim}
nvim_lsp.jsonls.setup{on_attach=on_attach_vim}
nvim_lsp.vimls.setup{on_attach=on_attach_vim}
nvim_lsp.yamlls.setup{on_attach=on_attach_vim}

nvim_lsp.pyls.setup{
    on_attach = on_attach_vim,
    settings = {
        pyls = {
            plugins = {
                pycodestyle = {
                    enabled = true,
                    maxLineLength = 120
                },
                pylint = {
                    enabled = true,
                    args = {
                        '--max-line-length=120',
                        '--disable=invalid-name'
                    }
                }
            }
        }
    }
}
EOF

nnoremap <silent> 1gD       <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> <Leader>[ <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> <Leader>] <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> <Leader>k <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> <Leader>s <cmd>lua vim.lsp.buf.document_symbol()<CR>
nnoremap <silent> <Leader>z <cmd>lua vim.lsp.buf.formatting()<CR>
nnoremap <silent> <Leader>K <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> gD        <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <silent> gW        <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
nnoremap <silent> gd        <cmd>lua vim.lsp.buf.declaration()<CR>
xnoremap <silent> <Leader>z <cmd>lua vim.lsp.buf.formatting()<CR>

" diagnostic-nvim
nnoremap <silent> <Leader>d :<C-u>OpenDiagnostic<CR>
nnoremap <silent> <Leader>n :<C-u>NextDiagnosticCycle<CR>
nnoremap <silent> <Leader>p :<C-u>PrevDiagnosticCycle<CR>
{'fraction_non_alphanumeric': 0.16317903191714225, 'fraction_numerical': 0.0029592052420207146, 'mean_word_length': 3.4390243902439024, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 121, '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': '1850718', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1874, 'n_words': 295}