local M = {} M.kind_icons = { Text = '', Method = '', Function = '', Constructor = '', Field = '', Variable = '', Class = 'ﴯ', Interface = '', Module = '', Property = 'ﰠ', Unit = '', Value = '', Enum = '', Keyword = '', Snippet = '', Color = '', File = '', Reference = '', Folder = '', EnumMember = '', Constant = '', Struct = '', Event = '', Operator = '', TypeParameter = '', } M.has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil end M.feline_theme = { fg = '#c9d1d9', bg = '#1f2428', green = '#66cc66', yellow = '#d5992a', purple = '#c678dd', orange = '#b17135', peanut = '#f6d5a4', red = '#e06c75', aqua = '#61afef', bg2 = '#24293a', dark_red = '#f75f5f', } M.feline_vi_mode_colors = { NORMAL = 'green', OP = 'green', INSERT = 'yellow', VISUAL = 'purple', LINES = 'orange', BLOCK = 'dark_red', REPLACE = 'red', COMMAND = 'aqua', } M.feline_c = { vim_mode = { provider = { name = 'vi_mode', opts = { show_mode_name = true, -- padding = "center", -- Uncomment for extra padding. }, }, hl = function() return { fg = require('feline.providers.vi_mode').get_mode_color(), bg = 'bg2', style = 'bold', name = 'NeovimModeHLColor', } end, left_sep = 'block', right_sep = 'block', }, gitBranch = { provider = 'git_branch', hl = { fg = 'peanut', bg = 'bg2', style = 'bold', }, left_sep = 'block', right_sep = 'block', }, gitDiffAdded = { provider = 'git_diff_added', hl = { fg = 'green', bg = 'bg2', }, left_sep = 'block', right_sep = 'block', }, gitDiffRemoved = { provider = 'git_diff_removed', hl = { fg = 'red', bg = 'bg2', }, left_sep = 'block', right_sep = 'block', }, gitDiffChanged = { provider = 'git_diff_changed', hl = { fg = 'fg', bg = 'bg2', }, left_sep = 'block', right_sep = 'right_filled', }, separator = { provider = '', }, file_info = { provider = { name = 'file_info', opts = { colored_icon = false, type = 'relative-short', }, }, hl = { style = 'bold', }, left_sep = ' ', right_sep = ' ', }, diagnostic_errors = { provider = 'diagnostic_errors', hl = { fg = 'red', }, }, diagnostic_warnings = { provider = 'diagnostic_warnings', hl = { fg = 'yellow', }, }, diagnostic_hints = { provider = 'diagnostic_hints', hl = { fg = 'aqua', }, }, diagnostic_info = { provider = 'diagnostic_info', }, lsp_client_names = { provider = 'lsp_client_names', hl = { fg = 'purple', bg = 'bg2', style = 'bold', }, left_sep = 'left_filled', right_sep = 'right_filled', }, file_type = { provider = { name = 'file_type', opts = { -- filetype_icon = true, colored_icon = false, case = 'titlecase', }, }, hl = { fg = 'red', bg = 'bg2', style = 'bold', }, left_sep = 'left_filled', right_sep = 'block', }, file_encoding = { provider = 'file_encoding', hl = { fg = 'orange', bg = 'bg2', -- style = 'italic', }, left_sep = 'block', right_sep = 'block', }, position = { provider = 'position', hl = { fg = 'green', bg = 'bg2', style = 'bold', }, left_sep = 'block', right_sep = 'block', }, line_percentage = { provider = 'line_percentage', hl = { fg = 'aqua', bg = 'bg2', style = 'bold', }, left_sep = 'block', right_sep = 'block', }, scroll_bar = { provider = 'scroll_bar', hl = { fg = 'yellow', style = 'bold', }, }, search_count = { provider = 'search_count', hl = { style = 'bold', bg = 'bg2', }, left_sep = 'block', right_sep = 'block', }, macro = { provider = 'macro', hl = { style = 'bold', bg = 'bg2', }, left_sep = 'block', right_sep = 'block', }, } function M.on_attach(client, bufnr) local has_formatter = #require("null-ls.sources").get_available(ft, "NULL_LS_FORMATTING") > 0 --[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]] if client.name == 'jdt.ls' then client.server_capabilities.documentFormattingProvider = false vim.lsp.codelens.refresh() if JAVA_DAP_ACTIVE then require('jdtls').setup_dap { hotcodereplace = 'auto' } require('jdtls.dap').setup_dap_main_class_configs() end end local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype') local enable = false if has_formatter then enable = client.name == 'null-ls' else enable = not (client.name == 'null-ls') end -- util.info(client.name .. " " .. (enable and "yes" or "no"), "format") client.server_capabilities.documentFormattingProvider = enable client.server_capabilities.semanticTokensProvider = false end M.lsp_config = { virtual_text = { prefix = '●', }, signs = false, underline = true, update_in_insert = true, severity_sort = false, float = { focusable = false, -- style = 'minimal', border = 'rounded', source = 'always', header = '', prefix = '', }, } return M