<commit_before>vim.cmd [[
if !has('gui_running') | set t_Co=256 | endif
if has('termguicolors') | set termguicolors | endif
]]

vim.opt.background = 'dark'
vim.opt.showmode = false

require("packer").startup(function()
    use 'wbthomason/packer.nvim'

    use 'tpope/vim-fugitive'
    use 'tpope/vim-projectionist'
    use 'tpope/vim-sensible'

    use 'neovim/nvim-lspconfig'

    use 'itchyny/lightline.vim'

    use {
        'sainnhe/edge',
        config = function()
            vim.g.edge_style = 'neon'
            vim.g.lightline = { colorscheme = 'edge' }
            vim.cmd [[colorscheme edge]]
        end
    }
    use {
        'sainnhe/sonokai',
        disable = true,
        config = function()
            vim.g.edge_style = 'shusia'
            vim.g.lightline = { colorscheme = 'sonokai' }
            vim.cmd [[colorscheme sonokai]]
        end
    }
end)

vim.cmd [[autocmd BufWritePre * :%s/\s\+$//e]]

vim.opt.cursorline = true
vim.opt.diffopt:append({'algorithm:patience', 'indent-heuristic'})
vim.opt.fileencoding = "utf-8"
vim.opt.list = true
vim.opt.number = true; vim.opt.relativenumber = true
vim.opt.smartindent = true
vim.opt.swapfile = false; vim.opt.backup = false
vim.opt.tabstop = 4; vim.opt.sw = 4; vim.opt.sts = 4; vim.opt.expandtab = true

vim.cmd([[
augroup ft_git
    autocmd!
    autocmd BufNewFile,BufRead gitconfig setlocal filetype=gitconfig
    autocmd FileType gitcommit setlocal spell spelllang=en_us
augroup END
]])

vim.cmd([[
augroup packer_auto_sync
    autocmd!
    autocmd BufWritePost init.lua source <afile> | PackerSync
augroup end
]])


-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
    -- Enable completion triggered by <c-x><c-o>
    vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')

    -- Mappings.
    -- See `:help vim.lsp.*` for documentation on any of the below functions
    local bufopts = { noremap = true, silent = true, buffer = bufnr }
    vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
    vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
    vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
    vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
    vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
    vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
    vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
    vim.keymap.set('n', '<space>wl', function()
        print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
    end, bufopts)
    vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
    vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
    vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
    vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
    vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
end

local lsp_flags = {
    -- This is the default in Nvim 0.7+
    debounce_text_changes = 150,
}

require('lspconfig').sumneko_lua.setup({
    on_attach = on_attach,
    lsp_flags = lsp_flags
})
<commit_msg>nvim-lspconfig: Configure sumneko_lua for nvim<commit_after>vim.cmd [[
if !has('gui_running') | set t_Co=256 | endif
if has('termguicolors') | set termguicolors | endif
]]

vim.opt.background = 'dark'
vim.opt.showmode = false

require("packer").startup(function()
    use 'wbthomason/packer.nvim'

    use 'tpope/vim-fugitive'
    use 'tpope/vim-projectionist'
    use 'tpope/vim-sensible'

    use 'neovim/nvim-lspconfig'

    use 'itchyny/lightline.vim'

    use {
        'sainnhe/edge',
        config = function()
            vim.g.edge_style = 'neon'
            vim.g.lightline = { colorscheme = 'edge' }
            vim.cmd [[colorscheme edge]]
        end
    }
    use {
        'sainnhe/sonokai',
        disable = true,
        config = function()
            vim.g.edge_style = 'shusia'
            vim.g.lightline = { colorscheme = 'sonokai' }
            vim.cmd [[colorscheme sonokai]]
        end
    }
end)

vim.cmd [[autocmd BufWritePre * :%s/\s\+$//e]]

vim.opt.cursorline = true
vim.opt.diffopt:append({'algorithm:patience', 'indent-heuristic'})
vim.opt.fileencoding = "utf-8"
vim.opt.list = true
vim.opt.number = true; vim.opt.relativenumber = true
vim.opt.smartindent = true
vim.opt.swapfile = false; vim.opt.backup = false
vim.opt.tabstop = 4; vim.opt.sw = 4; vim.opt.sts = 4; vim.opt.expandtab = true

vim.cmd([[
augroup ft_git
    autocmd!
    autocmd BufNewFile,BufRead gitconfig setlocal filetype=gitconfig
    autocmd FileType gitcommit setlocal spell spelllang=en_us
augroup END
]])

vim.cmd([[
augroup packer_auto_sync
    autocmd!
    autocmd BufWritePost init.lua source <afile> | PackerSync
augroup end
]])


-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
    -- Enable completion triggered by <c-x><c-o>
    vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')

    -- Mappings.
    -- See `:help vim.lsp.*` for documentation on any of the below functions
    local bufopts = { noremap = true, silent = true, buffer = bufnr }
    vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
    vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
    vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
    vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
    vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
    vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
    vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
    vim.keymap.set('n', '<space>wl', function()
        print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
    end, bufopts)
    vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
    vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
    vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
    vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
    vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
end

local lsp_flags = {
    -- This is the default in Nvim 0.7+
    debounce_text_changes = 150,
}

require('lspconfig').sumneko_lua.setup({
    on_attach = on_attach,
    lsp_flags = lsp_flags,
    settings = { Lua = {
        runtime = { version = 'LuaJIT' },
        diagnostics = { globals = { 'vim' } },
        workspace = { library = vim.api.nvim_get_runtime_file('', true) },
        telemetry = { enable = false }
    }
}})

{'fraction_non_alphanumeric': 0.15759925143697368, 'fraction_numerical': 0.003208127255714477, 'mean_word_length': 3.3049482163406214, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '429621', 'n_tokens_mistral': 3001, 'n_tokens_neox': 2865, 'n_words': 563}