2023-04-15 15:47:38 +02:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
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.lsp_config = {
|
2023-07-02 22:18:22 +02:00
|
|
|
-- virtual_text = {
|
|
|
|
-- prefix = '●',
|
|
|
|
-- },
|
|
|
|
virtual_text = false,
|
2023-04-15 15:47:38 +02:00
|
|
|
signs = false,
|
|
|
|
underline = true,
|
2023-07-02 22:18:22 +02:00
|
|
|
update_in_insert = false,
|
2023-04-15 15:47:38 +02:00
|
|
|
severity_sort = false,
|
|
|
|
float = {
|
|
|
|
focusable = false,
|
|
|
|
-- style = 'minimal',
|
|
|
|
border = 'rounded',
|
|
|
|
source = 'always',
|
|
|
|
header = '',
|
|
|
|
prefix = '',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-06-20 19:00:40 +02:00
|
|
|
M.lspservername = function()
|
|
|
|
local msg = ''
|
|
|
|
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
|
|
|
local clients = vim.lsp.get_active_clients()
|
|
|
|
if next(clients) == nil then return msg end
|
|
|
|
for _, client in ipairs(clients) do
|
|
|
|
local filetypes = client.config.filetypes
|
|
|
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
|
|
|
return client.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return msg
|
|
|
|
end
|
|
|
|
|
|
|
|
M.feline_theme = {
|
|
|
|
fg = '#c9d1d9',
|
|
|
|
bg = '#101010',
|
|
|
|
green = '#66cc66',
|
|
|
|
yellow = '#ffdd11',
|
|
|
|
purple = '#c678dd',
|
|
|
|
orange = '#cc8c3c',
|
|
|
|
peanut = '#f6d5a4',
|
|
|
|
red = '#e06c75',
|
|
|
|
aqua = '#61afef',
|
|
|
|
bg2 = '#484848',
|
|
|
|
dark_red = '#f75f5f',
|
|
|
|
normal = '#A9A9A9'
|
|
|
|
}
|
|
|
|
|
|
|
|
M.feline_vi_mode_colors = {
|
|
|
|
NORMAL = 'normal',
|
|
|
|
OP = 'green',
|
|
|
|
INSERT = 'yellow',
|
|
|
|
VISUAL = 'orange',
|
|
|
|
LINES = 'orange',
|
|
|
|
BLOCK = 'dark_red',
|
|
|
|
REPLACE = 'red',
|
|
|
|
COMMAND = 'aqua',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local left_component_separator = {
|
|
|
|
str = ' ',
|
|
|
|
hl = {
|
|
|
|
fg = '#4a4a4a',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
local right_component_separator = {
|
|
|
|
str = ' ',
|
|
|
|
hl = {
|
|
|
|
fg = '#4a4a4a',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
local left_section_separator = {
|
|
|
|
str = '█',
|
|
|
|
hl = {
|
|
|
|
fg = 'normal',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
local right_section_separator = {
|
|
|
|
str = '',
|
|
|
|
hl = {
|
|
|
|
fg = '#4a4a4a',
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
local function selectionCount()
|
|
|
|
local isVisualMode = vim.fn.mode():find("[Vv]")
|
|
|
|
if not isVisualMode then return "" end
|
|
|
|
local starts = vim.fn.line("v")
|
|
|
|
local ends = vim.fn.line(".")
|
|
|
|
local lines = starts <= ends and ends - starts + 1 or starts - ends + 1
|
|
|
|
return "" .. tostring(lines) .. "L " .. tostring(vim.fn.wordcount().visual_chars) .. "C"
|
|
|
|
end
|
|
|
|
|
2023-06-25 17:10:09 +02:00
|
|
|
local function startupTime()
|
|
|
|
return tostring(require'lazy'.stats().startuptime)
|
|
|
|
end
|
|
|
|
|
2023-06-20 19:00:40 +02:00
|
|
|
M.feline_c = {
|
|
|
|
right_separator = {
|
|
|
|
provider = '',
|
|
|
|
left_sep = ' ',
|
|
|
|
hl = {
|
|
|
|
fg = '#484848'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
left_separator = {
|
|
|
|
provider = '',
|
|
|
|
left_sep = ' ',
|
|
|
|
hl = {
|
|
|
|
fg = '#484848'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
vim_mode = {
|
|
|
|
provider = {
|
|
|
|
name = 'vi_mode',
|
|
|
|
opts = {
|
|
|
|
show_mode_name = true,
|
|
|
|
-- padding = "center", -- Uncomment for extra padding.
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
bg = require('feline.providers.vi_mode').get_mode_color(),
|
|
|
|
fg = 'bg',
|
|
|
|
style = 'bold',
|
|
|
|
name = 'NeovimModeHLColor',
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
left_sep = 'block',
|
|
|
|
right_sep = {
|
|
|
|
str = '█',
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
fg = require('feline.providers.vi_mode').get_mode_color(),
|
|
|
|
style = 'bold',
|
|
|
|
name = 'NeovimModeHLColor',
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
file_info = {
|
|
|
|
provider = {
|
|
|
|
name = 'file_info',
|
|
|
|
opts = {
|
|
|
|
colored_icon = true,
|
|
|
|
type = 'relative-short',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hl = {
|
|
|
|
fg = 'bg2',
|
|
|
|
},
|
|
|
|
left_sep = ' ',
|
|
|
|
},
|
|
|
|
lsp_client_names = {
|
|
|
|
provider = 'lsp_client_names',
|
|
|
|
hl = {
|
|
|
|
fg = 'bg2',
|
|
|
|
},
|
|
|
|
left_sep = 'right',
|
|
|
|
},
|
|
|
|
file_type = {
|
|
|
|
provider = {
|
|
|
|
name = 'file_type',
|
|
|
|
opts = {
|
|
|
|
filetype_icon = false,
|
|
|
|
colored_icon = false,
|
|
|
|
case = 'lowercase',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hl = {
|
|
|
|
fg = 'bg2',
|
|
|
|
},
|
|
|
|
left_sep = left_component_separator,
|
|
|
|
right_sep = ' ',
|
|
|
|
},
|
|
|
|
file_encoding = {
|
|
|
|
provider = 'file_encoding',
|
|
|
|
hl = {
|
|
|
|
fg = 'bg2',
|
|
|
|
},
|
|
|
|
left_sep = left_component_separator,
|
|
|
|
right_sep = ' ',
|
|
|
|
},
|
|
|
|
position = {
|
|
|
|
provider = 'position',
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
bg = require('feline.providers.vi_mode').get_mode_color(),
|
|
|
|
fg = 'bg',
|
|
|
|
style = 'bold',
|
|
|
|
name = 'NeovimModeHLColor',
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
right_sep = 'block',
|
|
|
|
left_sep = {
|
|
|
|
str = '█',
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
fg = require('feline.providers.vi_mode').get_mode_color(),
|
|
|
|
style = 'bold',
|
|
|
|
name = 'NeovimModeHLColor',
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
2023-06-25 17:10:09 +02:00
|
|
|
startup = {
|
|
|
|
provider = startupTime,
|
|
|
|
left_sep = ' ',
|
|
|
|
right_sep = ' ',
|
|
|
|
},
|
2023-06-20 19:00:40 +02:00
|
|
|
select_count = {
|
|
|
|
provider = selectionCount,
|
|
|
|
hl = function()
|
|
|
|
return {
|
|
|
|
fg = require('feline.providers.vi_mode').get_mode_color(),
|
|
|
|
style = 'bold',
|
|
|
|
name = 'NeovimModeHLColor',
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
left_sep = ' ',
|
|
|
|
right_sep = ' ',
|
|
|
|
},
|
|
|
|
line_percentage = {
|
|
|
|
provider = 'line_percentage',
|
|
|
|
hl = {
|
|
|
|
fg = 'normal',
|
|
|
|
},
|
|
|
|
left_sep = ' ',
|
|
|
|
right_sep = ' ',
|
|
|
|
},
|
|
|
|
scroll_bar = {
|
|
|
|
provider = 'scroll_bar',
|
|
|
|
hl = {
|
|
|
|
fg = 'yellow',
|
|
|
|
style = 'bold',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
search_count = {
|
|
|
|
provider = 'search_count',
|
|
|
|
left_sep = left_component_separator,
|
|
|
|
right_sep = ' ',
|
|
|
|
},
|
|
|
|
macro = {
|
|
|
|
provider = 'macro',
|
|
|
|
hl = {
|
|
|
|
style = 'bold',
|
|
|
|
bg = 'bg2',
|
|
|
|
},
|
|
|
|
left_sep = 'block',
|
|
|
|
right_sep = 'block',
|
|
|
|
},
|
|
|
|
gitBranch = {
|
|
|
|
provider = 'git_branch',
|
|
|
|
hl = {
|
|
|
|
fg = 'peanut',
|
|
|
|
bg = 'bg2',
|
|
|
|
style = 'bold',
|
|
|
|
},
|
|
|
|
left_sep = ' ',
|
|
|
|
right_sep = right_section_separator,
|
|
|
|
},
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-04-15 15:47:38 +02:00
|
|
|
return M
|