| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 | local function_wrapper = {}function function_wrapper.define_augroups(definitions) -- {{{1    -- Create autocommand groups based on the passed definitions    --    -- The key will be the name of the group, and each definition    -- within the group should have:    --    1. Trigger    --    2. Pattern    --    3. Text    -- just like how they would normally be defined from Vim itself    for group_name, definition in pairs(definitions) do        vim.cmd('augroup ' .. group_name)        vim.cmd('autocmd!')        for _, def in pairs(definition) do            local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ')            vim.cmd(command)        end        vim.cmd('augroup END')    endendfunction_wrapper.define_augroups(    {_general_settings = {            {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'IncSearch\', timeout = 200})'},            {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},            {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},            {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},            {'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'},            {'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},            {'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},            {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},            {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},        },    })-- Add this to lightbulb, java makes this annoying tho-- autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()-- lspfunction function_wrapper.add_to_workspace_folder()    vim.lsp.buf.add_workspace_folder()endfunction function_wrapper.clear_references()    vim.lsp.buf.clear_references()endfunction function_wrapper.code_action()    vim.lsp.buf.code_action()endfunction function_wrapper.declaration()    vim.lsp.buf.declaration()    vim.lsp.buf.clear_references()endfunction function_wrapper.definition()    vim.lsp.buf.definition()    vim.lsp.buf.clear_references()endfunction function_wrapper.document_highlight()    vim.lsp.buf.document_highlight()endfunction function_wrapper.document_symbol()    vim.lsp.buf.document_symbol()endfunction function_wrapper.formatting()    vim.lsp.buf.formatting()endfunction function_wrapper.formatting_sync()    vim.lsp.buf.formatting_sync()endfunction function_wrapper.hover()    vim.lsp.buf.hover()endfunction function_wrapper.implementation()    vim.lsp.buf.implementation()endfunction function_wrapper.incoming_calls()    vim.lsp.buf.incoming_calls()endfunction function_wrapper.list_workspace_folders()    vim.lsp.buf.list_workspace_folders()endfunction function_wrapper.outgoing_calls()    vim.lsp.buf.outgoing_calls()endfunction function_wrapper.range_code_action()    vim.lsp.buf.range_code_action()endfunction function_wrapper.range_formatting()    vim.lsp.buf.range_formatting()endfunction function_wrapper.references()    vim.lsp.buf.references()    vim.lsp.buf.clear_references()endfunction function_wrapper.remove_workspace_folder()    vim.lsp.buf.remove_workspace_folder()endfunction function_wrapper.rename()    vim.lsp.buf.rename()endfunction function_wrapper.signature_help()    vim.lsp.buf.signature_help()endfunction function_wrapper.type_definition()    vim.lsp.buf.type_definition()endfunction function_wrapper.workspace_symbol()    vim.lsp.buf.workspace_symbol()end-- diagnosticfunction function_wrapper.get_all()    vim.lsp.diagnostic.get_all()endfunction function_wrapper.get_next()    vim.lsp.diagnostic.get_next()endfunction function_wrapper.get_prev()    vim.lsp.diagnostic.get_prev()endfunction function_wrapper.goto_next()    vim.lsp.diagnostic.goto_next()endfunction function_wrapper.goto_prev()    vim.lsp.diagnostic.goto_prev()endfunction function_wrapper.show_line_diagnostics()    vim.lsp.diagnostic.show_line_diagnostics()end-- git signsfunction function_wrapper.next_hunk()     require('gitsigns').next_hunk()endfunction function_wrapper.prev_hunk()    require('gitsigns').prev_hunk()endfunction function_wrapper.stage_hunk()    require('gitsigns').stage_hunk()endfunction function_wrapper.undo_stage_hunk()    require('gitsigns').undo_stage_hunk()endfunction function_wrapper.reset_hunk()    require('gitsigns').reset_hunk()endfunction function_wrapper.reset_buffer()    require('gitsigns').reset_buffer()endfunction function_wrapper.preview_hunk()    require('gitsigns').preview_hunk()endfunction function_wrapper.blame_line()    require('gitsigns').blame_line()end-- misc-- autoformat-- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)return function_wrapper
 |