Hopefully bootstraps correctly on a new system
This commit is contained in:
parent
89aac722fc
commit
1462720909
94
configs/nvim/after/plugin/bar.lua
Normal file
94
configs/nvim/after/plugin/bar.lua
Normal file
@ -0,0 +1,94 @@
|
||||
-- Set barbar's options
|
||||
require'bufferline'.setup {
|
||||
-- Enable/disable animations
|
||||
animation = true,
|
||||
|
||||
-- Enable/disable auto-hiding the tab bar when there is a single buffer
|
||||
auto_hide = false,
|
||||
|
||||
-- Enable/disable current/total tabpages indicator (top right corner)
|
||||
tabpages = true,
|
||||
|
||||
-- Enable/disable close button
|
||||
closable = true,
|
||||
|
||||
-- Enables/disable clickable tabs
|
||||
-- - left-click: go to buffer
|
||||
-- - middle-click: delete buffer
|
||||
clickable = true,
|
||||
|
||||
-- Enables / disables diagnostic symbols
|
||||
diagnostics = {
|
||||
-- you can use a list
|
||||
{enabled = true, icon = 'ff'}, -- ERROR
|
||||
{enabled = false}, -- WARN
|
||||
{enabled = false}, -- INFO
|
||||
{enabled = true}, -- HINT
|
||||
|
||||
-- OR `vim.diagnostic.severity`
|
||||
[vim.diagnostic.severity.ERROR] = {enabled = true, icon = 'ff'},
|
||||
[vim.diagnostic.severity.WARN] = {enabled = false},
|
||||
[vim.diagnostic.severity.INFO] = {enabled = false},
|
||||
[vim.diagnostic.severity.HINT] = {enabled = true},
|
||||
},
|
||||
|
||||
-- Excludes buffers from the tabline
|
||||
exclude_ft = {'javascript'},
|
||||
exclude_name = {'package.json'},
|
||||
|
||||
-- Hide inactive buffers and file extensions. Other options are `alternate`, `current`, and `visible`.
|
||||
-- hide = {extensions = true, inactive = true},
|
||||
|
||||
-- Disable highlighting alternate buffers
|
||||
highlight_alternate = false,
|
||||
|
||||
-- Enable highlighting visible buffers
|
||||
highlight_visible = true,
|
||||
|
||||
-- Enable/disable icons
|
||||
-- if set to 'numbers', will show buffer index in the tabline
|
||||
-- if set to 'both', will show buffer index and icons in the tabline
|
||||
icons = false,
|
||||
|
||||
-- If set, the icon color will follow its corresponding buffer
|
||||
-- highlight group. By default, the Buffer*Icon group is linked to the
|
||||
-- Buffer* group (see Highlighting below). Otherwise, it will take its
|
||||
-- default value as defined by devicons.
|
||||
icon_custom_colors = false,
|
||||
|
||||
-- Configure icons on the bufferline.
|
||||
icon_separator_active = '▎',
|
||||
icon_separator_inactive = '▎',
|
||||
icon_close_tab = '',
|
||||
icon_close_tab_modified = '●',
|
||||
icon_pinned = '車',
|
||||
|
||||
-- If true, new buffers will be inserted at the start/end of the list.
|
||||
-- Default is to insert after current buffer.
|
||||
insert_at_end = false,
|
||||
insert_at_start = false,
|
||||
|
||||
-- Sets the maximum padding width with which to surround each tab
|
||||
maximum_padding = 1,
|
||||
|
||||
-- Sets the minimum padding width with which to surround each tab
|
||||
minimum_padding = 1,
|
||||
|
||||
-- Sets the maximum buffer name length.
|
||||
maximum_length = 30,
|
||||
|
||||
-- If set, the letters for each buffer in buffer-pick mode will be
|
||||
-- assigned based on their name. Otherwise or in case all letters are
|
||||
-- already assigned, the behavior is to assign letters in order of
|
||||
-- usability (see order below)
|
||||
semantic_letters = true,
|
||||
|
||||
-- New buffer letters are assigned in this order. This order is
|
||||
-- optimal for the qwerty keyboard layout but might need adjustement
|
||||
-- for other layouts.
|
||||
letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP',
|
||||
|
||||
-- Sets the name of unnamed buffers. By default format is "[Buffer X]"
|
||||
-- where X is the buffer number. But only a static string is accepted here.
|
||||
no_name_title = nil,
|
||||
}
|
@ -1,446 +1,296 @@
|
||||
-- require('feline').setup()
|
||||
---depends om https://github.com/feline-nvim/feline.nvim
|
||||
local present, feline = pcall(require, "feline")
|
||||
|
||||
local fmt = string.format
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Colors
|
||||
|
||||
---Convert color number to hex string
|
||||
---@param n number
|
||||
---@return string
|
||||
local hex = function(n)
|
||||
if n then
|
||||
return fmt("#%06x", n)
|
||||
end
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
---Parse `style` string into nvim_set_hl options
|
||||
---@param style string
|
||||
---@return table
|
||||
local function parse_style(style)
|
||||
if not style or style == "NONE" then
|
||||
return {}
|
||||
end
|
||||
local theme = {
|
||||
aqua = "#7AB0DF",
|
||||
bg = "#1C212A",
|
||||
blue = "#5FB0FC",
|
||||
cyan = "#70C0BA",
|
||||
darkred = "#FB7373",
|
||||
fg = "#C7C7CA",
|
||||
gray = "#222730",
|
||||
green = "#79DCAA",
|
||||
lime = "#54CED6",
|
||||
orange = "#FFD064",
|
||||
pink = "#D997C8",
|
||||
purple = "#C397D8",
|
||||
red = "#F87070",
|
||||
yellow = "#FFE59E"
|
||||
}
|
||||
|
||||
local result = {}
|
||||
for token in string.gmatch(style, "([^,]+)") do
|
||||
result[token] = true
|
||||
end
|
||||
local mode_theme = {
|
||||
["NORMAL"] = theme.green,
|
||||
["OP"] = theme.cyan,
|
||||
["INSERT"] = theme.aqua,
|
||||
["VISUAL"] = theme.yellow,
|
||||
["LINES"] = theme.darkred,
|
||||
["BLOCK"] = theme.orange,
|
||||
["REPLACE"] = theme.purple,
|
||||
["V-REPLACE"] = theme.pink,
|
||||
["ENTER"] = theme.pink,
|
||||
["MORE"] = theme.pink,
|
||||
["SELECT"] = theme.darkred,
|
||||
["SHELL"] = theme.cyan,
|
||||
["TERM"] = theme.lime,
|
||||
["NONE"] = theme.gray,
|
||||
["COMMAND"] = theme.blue,
|
||||
}
|
||||
|
||||
return result
|
||||
end
|
||||
local component = {}
|
||||
|
||||
---Get highlight opts for a given highlight group name
|
||||
---@param name string
|
||||
---@return table
|
||||
local function get_highlight(name)
|
||||
local hl = vim.api.nvim_get_hl_by_name(name, true)
|
||||
if hl.link then
|
||||
return get_highlight(hl.link)
|
||||
end
|
||||
|
||||
local result = parse_style(hl.style)
|
||||
result.fg = hl.foreground and hex(hl.foreground)
|
||||
result.bg = hl.background and hex(hl.background)
|
||||
result.sp = hl.special and hex(hl.special)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
---Set highlight group from provided table
|
||||
---@param groups table
|
||||
local function set_highlights(groups)
|
||||
for group, opts in pairs(groups) do
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
end
|
||||
|
||||
---Generate a color palette from the current applied colorscheme
|
||||
---@return table
|
||||
local function generate_pallet_from_colorscheme()
|
||||
-- stylua: ignore
|
||||
local color_map = {
|
||||
black = { index = 0, default = "#393b44" },
|
||||
red = { index = 1, default = "#c94f6d" },
|
||||
green = { index = 2, default = "#81b29a" },
|
||||
yellow = { index = 3, default = "#dbc074" },
|
||||
blue = { index = 4, default = "#719cd6" },
|
||||
magenta = { index = 5, default = "#9d79d6" },
|
||||
cyan = { index = 6, default = "#63cdcf" },
|
||||
white = { index = 7, default = "#dfdfe0" },
|
||||
}
|
||||
|
||||
local diagnostic_map = {
|
||||
hint = { hl = "DiagnosticHint", default = color_map.green.default },
|
||||
info = { hl = "DiagnosticInfo", default = color_map.blue.default },
|
||||
warn = { hl = "DiagnosticWarn", default = color_map.yellow.default },
|
||||
error = { hl = "DiagnosticError", default = color_map.red.default },
|
||||
}
|
||||
|
||||
local pallet = {}
|
||||
for name, value in pairs(color_map) do
|
||||
local global_name = "terminal_color_" .. value.index
|
||||
pallet[name] = vim.g[global_name] and vim.g[global_name] or value.default
|
||||
end
|
||||
|
||||
for name, value in pairs(diagnostic_map) do
|
||||
pallet[name] = get_highlight(value.hl).fg or value.default
|
||||
end
|
||||
|
||||
pallet.sl = get_highlight("StatusLine")
|
||||
pallet.sel = get_highlight("TabLineSel")
|
||||
|
||||
return pallet
|
||||
end
|
||||
|
||||
---Generate user highlight groups based on the curent applied colorscheme
|
||||
---
|
||||
---NOTE: This is a global because I dont known where this file will be in your config
|
||||
---and it is needed for the autocmd below
|
||||
_G._generate_user_statusline_highlights = function()
|
||||
local pal = generate_pallet_from_colorscheme()
|
||||
|
||||
-- stylua: ignore
|
||||
local sl_colors = {
|
||||
Black = { fg = pal.black, bg = pal.white },
|
||||
Red = { fg = pal.red, bg = pal.sl.bg },
|
||||
Green = { fg = pal.green, bg = pal.sl.bg },
|
||||
Yellow = { fg = pal.yellow, bg = pal.sl.bg },
|
||||
Blue = { fg = pal.blue, bg = pal.sl.bg },
|
||||
Magenta = { fg = pal.magenta, bg = pal.sl.bg },
|
||||
Cyan = { fg = pal.cyan, bg = pal.sl.bg },
|
||||
White = { fg = pal.white, bg = pal.black },
|
||||
}
|
||||
|
||||
local colors = {}
|
||||
for name, value in pairs(sl_colors) do
|
||||
colors["User" .. name] = { fg = value.fg, bg = value.bg, bold = true }
|
||||
colors["UserRv" .. name] = { fg = value.bg, bg = value.fg, bold = true }
|
||||
end
|
||||
|
||||
local status = vim.o.background == "dark" and { fg = pal.black, bg = pal.white } or { fg = pal.white, bg = pal.black }
|
||||
|
||||
local groups = {
|
||||
-- statusline
|
||||
UserSLHint = { fg = pal.sl.bg, bg = pal.hint, bold = true },
|
||||
UserSLInfo = { fg = pal.sl.bg, bg = pal.info, bold = true },
|
||||
UserSLWarn = { fg = pal.sl.bg, bg = pal.warn, bold = true },
|
||||
UserSLError = { fg = pal.sl.bg, bg = pal.error, bold = true },
|
||||
UserSLStatus = { fg = status.fg, bg = status.bg, bold = true },
|
||||
|
||||
UserSLFtHint = { fg = pal.sel.bg, bg = pal.hint },
|
||||
UserSLHintInfo = { fg = pal.hint, bg = pal.info },
|
||||
UserSLInfoWarn = { fg = pal.info, bg = pal.warn },
|
||||
UserSLWarnError = { fg = pal.warn, bg = pal.error },
|
||||
UserSLErrorStatus = { fg = pal.error, bg = status.bg },
|
||||
UserSLStatusBg = { fg = status.bg, bg = pal.sl.bg },
|
||||
|
||||
UserSLAlt = pal.sel,
|
||||
UserSLAltSep = { fg = pal.sl.bg, bg = pal.sel.bg },
|
||||
UserSLGitBranch = { fg = pal.yellow, bg = pal.sl.bg },
|
||||
}
|
||||
|
||||
set_highlights(vim.tbl_extend("force", colors, groups))
|
||||
end
|
||||
|
||||
_generate_user_statusline_highlights()
|
||||
|
||||
vim.api.nvim_create_augroup("UserStatuslineHighlightGroups", { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "SessionLoadPost", "ColorScheme" }, {
|
||||
callback = function()
|
||||
_generate_user_statusline_highlights()
|
||||
component.vim_mode = {
|
||||
provider = function()
|
||||
return vim.api.nvim_get_mode().mode:upper()
|
||||
end,
|
||||
})
|
||||
hl = function()
|
||||
return {
|
||||
fg = "bg",
|
||||
bg = require("feline.providers.vi_mode").get_mode_color(),
|
||||
style = "bold",
|
||||
name = "NeovimModeHLColor",
|
||||
}
|
||||
end,
|
||||
left_sep = "block",
|
||||
right_sep = "block",
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Feline
|
||||
|
||||
local vi = {
|
||||
-- Map vi mode to text name
|
||||
text = {
|
||||
n = "NORMAL",
|
||||
no = "NORMAL",
|
||||
i = "INSERT",
|
||||
v = "VISUAL",
|
||||
V = "V-LINE",
|
||||
[""] = "V-BLOCK",
|
||||
c = "COMMAND",
|
||||
cv = "COMMAND",
|
||||
ce = "COMMAND",
|
||||
R = "REPLACE",
|
||||
Rv = "REPLACE",
|
||||
s = "SELECT",
|
||||
S = "SELECT",
|
||||
[""] = "SELECT",
|
||||
t = "TERMINAL",
|
||||
component.git_branch = {
|
||||
provider = "git_branch",
|
||||
hl = {
|
||||
fg = "fg",
|
||||
bg = "bg",
|
||||
style = "bold",
|
||||
},
|
||||
left_sep = "block",
|
||||
right_sep = "",
|
||||
}
|
||||
|
||||
-- Maps vi mode to highlight group color defined above
|
||||
colors = {
|
||||
n = "UserRvCyan",
|
||||
no = "UserRvCyan",
|
||||
i = "UserSLStatus",
|
||||
v = "UserRvMagenta",
|
||||
V = "UserRvMagenta",
|
||||
[""] = "UserRvMagenta",
|
||||
R = "UserRvRed",
|
||||
Rv = "UserRvRed",
|
||||
r = "UserRvBlue",
|
||||
rm = "UserRvBlue",
|
||||
s = "UserRvMagenta",
|
||||
S = "UserRvMagenta",
|
||||
[""] = "FelnMagenta",
|
||||
c = "UserRvYellow",
|
||||
["!"] = "UserRvBlue",
|
||||
t = "UserRvBlue",
|
||||
component.git_add = {
|
||||
provider = "git_diff_added",
|
||||
hl = {
|
||||
fg = "green",
|
||||
bg = "bg",
|
||||
},
|
||||
left_sep = "",
|
||||
right_sep = "",
|
||||
}
|
||||
|
||||
-- Maps vi mode to seperator highlight goup defined above
|
||||
sep = {
|
||||
n = "UserCyan",
|
||||
no = "UserCyan",
|
||||
i = "UserSLStatusBg",
|
||||
v = "UserMagenta",
|
||||
V = "UserMagenta",
|
||||
[""] = "UserMagenta",
|
||||
R = "UserRed",
|
||||
Rv = "UserRed",
|
||||
r = "UserBlue",
|
||||
rm = "UserBlue",
|
||||
s = "UserMagenta",
|
||||
S = "UserMagenta",
|
||||
[""] = "FelnMagenta",
|
||||
c = "UserYellow",
|
||||
["!"] = "UserBlue",
|
||||
t = "UserBlue",
|
||||
component.git_delete = {
|
||||
provider = "git_diff_removed",
|
||||
hl = {
|
||||
fg = "red",
|
||||
bg = "bg",
|
||||
},
|
||||
left_sep = "",
|
||||
right_sep = "",
|
||||
}
|
||||
|
||||
component.git_change = {
|
||||
provider = "git_diff_changed",
|
||||
hl = {
|
||||
fg = "purple",
|
||||
bg = "bg",
|
||||
},
|
||||
left_sep = "",
|
||||
right_sep = "",
|
||||
}
|
||||
|
||||
component.separator = {
|
||||
provider = "",
|
||||
hl = {
|
||||
fg = "bg",
|
||||
bg = "bg",
|
||||
},
|
||||
}
|
||||
|
||||
local icons = {
|
||||
locker = "", -- #f023
|
||||
page = "☰", -- 2630
|
||||
line_number = "", -- e0a1
|
||||
connected = "", -- f817
|
||||
dos = "", -- e70f
|
||||
unix = "", -- f17c
|
||||
mac = "", -- f179
|
||||
mathematical_L = "𝑳",
|
||||
vertical_bar = "┃",
|
||||
vertical_bar_thin = "│",
|
||||
left = "",
|
||||
right = "",
|
||||
block = "█",
|
||||
left_filled = "",
|
||||
right_filled = "",
|
||||
slant_left = "",
|
||||
slant_left_thin = "",
|
||||
slant_right = "",
|
||||
slant_right_thin = "",
|
||||
slant_left_2 = "",
|
||||
slant_left_2_thin = "",
|
||||
slant_right_2 = "",
|
||||
slant_right_2_thin = "",
|
||||
left_rounded = "",
|
||||
left_rounded_thin = "",
|
||||
right_rounded = "",
|
||||
right_rounded_thin = "",
|
||||
circle = "●",
|
||||
}
|
||||
|
||||
---Get the number of diagnostic messages for the provided severity
|
||||
---@param str string [ERROR | WARN | INFO | HINT]
|
||||
---@return string
|
||||
local function get_diag(str)
|
||||
local diagnostics = vim.diagnostic.get(0, { severity = vim.diagnostic.severity[str] })
|
||||
local count = #diagnostics
|
||||
|
||||
return (count > 0) and " " .. count .. " " or ""
|
||||
end
|
||||
|
||||
---Get highlight group from vi mode
|
||||
---@return string
|
||||
local function vi_mode_hl()
|
||||
return vi.colors[vim.fn.mode()] or "UserSLViBlack"
|
||||
end
|
||||
|
||||
---Get sep highlight group from vi mode
|
||||
local function vi_sep_hl()
|
||||
return vi.sep[vim.fn.mode()] or "UserSLBlack"
|
||||
end
|
||||
|
||||
---Get the path of the file relative to the cwd
|
||||
---@return string
|
||||
local function file_info()
|
||||
local list = {}
|
||||
if vim.bo.readonly then
|
||||
table.insert(list, "🔒")
|
||||
end
|
||||
|
||||
if vim.bo.modified then
|
||||
table.insert(list, "●")
|
||||
end
|
||||
|
||||
table.insert(list, vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":~:."))
|
||||
|
||||
return table.concat(list, " ")
|
||||
end
|
||||
|
||||
-- Create a table that contians every status line commonent
|
||||
local c = {
|
||||
vimode = {
|
||||
provider = function()
|
||||
return fmt(" %s ", vi.text[vim.fn.mode()])
|
||||
end,
|
||||
hl = vi_mode_hl,
|
||||
right_sep = { str = " ", hl = vi_sep_hl },
|
||||
},
|
||||
gitbranch = {
|
||||
provider = "git_branch",
|
||||
icon = " ",
|
||||
hl = "UserSLGitBranch",
|
||||
right_sep = { str = " ", hl = "UserSLGitBranch" },
|
||||
enabled = function()
|
||||
return vim.b.gitsigns_status_dict ~= nil
|
||||
end,
|
||||
},
|
||||
file_type = {
|
||||
provider = function()
|
||||
return fmt(" %s ", vim.bo.filetype:upper())
|
||||
end,
|
||||
hl = "UserSLAlt",
|
||||
},
|
||||
fileinfo = {
|
||||
provider = { name = "file_info", opts = { type = "relative" } },
|
||||
hl = "UserSLAlt",
|
||||
left_sep = { str = " ", hl = "UserSLAltSep" },
|
||||
right_sep = { str = " ", hl = "UserSLAltSep" },
|
||||
},
|
||||
file_enc = {
|
||||
provider = function()
|
||||
local os = icons[vim.bo.fileformat] or ""
|
||||
return fmt(" %s %s ", os, vim.bo.fileencoding)
|
||||
end,
|
||||
hl = "StatusLine",
|
||||
left_sep = { str = icons.left_filled, hl = "UserSLAltSep" },
|
||||
},
|
||||
cur_position = {
|
||||
provider = function()
|
||||
-- TODO: What about 4+ diget line numbers?
|
||||
return fmt(" %3d:%-2d ", unpack(vim.api.nvim_win_get_cursor(0)))
|
||||
end,
|
||||
hl = vi_mode_hl,
|
||||
left_sep = { str = icons.left_filled, hl = vi_sep_hl },
|
||||
},
|
||||
cur_percent = {
|
||||
provider = function()
|
||||
return " " .. require("feline.providers.cursor").line_percentage() .. " "
|
||||
end,
|
||||
hl = vi_mode_hl,
|
||||
left_sep = { str = icons.left, hl = vi_mode_hl },
|
||||
},
|
||||
default = { -- needed to pass the parent StatusLine hl group to right hand side
|
||||
provider = "",
|
||||
hl = "StatusLine",
|
||||
},
|
||||
lsp_status = {
|
||||
provider = function()
|
||||
return vim.tbl_count(vim.lsp.buf_get_clients(0)) == 0 and "" or " ◦ "
|
||||
end,
|
||||
hl = "UserSLStatus",
|
||||
left_sep = { str = "", hl = "UserSLStatusBg", always_visible = true },
|
||||
right_sep = { str = "", hl = "UserSLErrorStatus", always_visible = true },
|
||||
},
|
||||
lsp_error = {
|
||||
provider = function()
|
||||
return get_diag("ERROR")
|
||||
end,
|
||||
hl = "UserSLError",
|
||||
right_sep = { str = "", hl = "UserSLWarnError", always_visible = true },
|
||||
},
|
||||
lsp_warn = {
|
||||
provider = function()
|
||||
return get_diag("WARN")
|
||||
end,
|
||||
hl = "UserSLWarn",
|
||||
right_sep = { str = "", hl = "UserSLInfoWarn", always_visible = true },
|
||||
},
|
||||
lsp_info = {
|
||||
provider = function()
|
||||
return get_diag("INFO")
|
||||
end,
|
||||
hl = "UserSLInfo",
|
||||
right_sep = { str = "", hl = "UserSLHintInfo", always_visible = true },
|
||||
},
|
||||
lsp_hint = {
|
||||
provider = function()
|
||||
return get_diag("HINT")
|
||||
end,
|
||||
hl = "UserSLHint",
|
||||
right_sep = { str = "", hl = "UserSLFtHint", always_visible = true },
|
||||
},
|
||||
|
||||
in_fileinfo = {
|
||||
provider = "file_info",
|
||||
hl = "StatusLine",
|
||||
},
|
||||
in_position = {
|
||||
provider = "position",
|
||||
hl = "StatusLine",
|
||||
},
|
||||
file_winbar = {
|
||||
provider = file_info,
|
||||
hl = "Comment",
|
||||
component.diagnostic_errors = {
|
||||
provider = "diagnostic_errors",
|
||||
hl = {
|
||||
fg = "red",
|
||||
},
|
||||
}
|
||||
|
||||
local active = {
|
||||
{ -- left
|
||||
c.vimode,
|
||||
c.gitbranch,
|
||||
c.fileinfo,
|
||||
c.default, -- must be last
|
||||
},
|
||||
{ -- right
|
||||
c.lsp_status,
|
||||
c.lsp_error,
|
||||
c.lsp_warn,
|
||||
c.lsp_info,
|
||||
c.lsp_hint,
|
||||
c.file_type,
|
||||
c.file_enc,
|
||||
c.cur_position,
|
||||
c.cur_percent,
|
||||
component.diagnostic_warnings = {
|
||||
provider = "diagnostic_warnings",
|
||||
hl = {
|
||||
fg = "yellow",
|
||||
},
|
||||
}
|
||||
|
||||
local inactive = {
|
||||
{ c.in_fileinfo }, -- left
|
||||
{ c.in_position }, -- right
|
||||
component.diagnostic_hints = {
|
||||
provider = "diagnostic_hints",
|
||||
hl = {
|
||||
fg = "aqua",
|
||||
},
|
||||
}
|
||||
|
||||
require("feline").setup({
|
||||
components = { active = active, inactive = inactive },
|
||||
highlight_reset_triggers = {},
|
||||
force_inactive = {
|
||||
filetypes = {
|
||||
"NvimTree",
|
||||
"packer",
|
||||
"dap-repl",
|
||||
"dapui_scopes",
|
||||
"dapui_stacks",
|
||||
"dapui_watches",
|
||||
"dapui_repl",
|
||||
"LspTrouble",
|
||||
"qf",
|
||||
"help",
|
||||
},
|
||||
buftypes = { "terminal" },
|
||||
bufnames = {},
|
||||
},
|
||||
disable = {
|
||||
filetypes = {
|
||||
"dashboard",
|
||||
"startify",
|
||||
component.diagnostic_info = {
|
||||
provider = "diagnostic_info",
|
||||
}
|
||||
|
||||
component.lsp = {
|
||||
provider = function()
|
||||
if not rawget(vim, "lsp") then
|
||||
return ""
|
||||
end
|
||||
|
||||
local progress = vim.lsp.util.get_progress_messages()[1]
|
||||
if vim.o.columns < 120 then
|
||||
return ""
|
||||
end
|
||||
|
||||
local clients = vim.lsp.get_active_clients({ bufnr = 0 })
|
||||
if #clients ~= 0 then
|
||||
if progress then
|
||||
local spinners = {
|
||||
"◜ ",
|
||||
"◠ ",
|
||||
"◝ ",
|
||||
"◞ ",
|
||||
"◡ ",
|
||||
"◟ ",
|
||||
}
|
||||
local ms = vim.loop.hrtime() / 1000000
|
||||
local frame = math.floor(ms / 120) % #spinners
|
||||
local content = string.format("%%<%s", spinners[frame + 1])
|
||||
return content or ""
|
||||
else
|
||||
return "לּ LSP"
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
hl = function()
|
||||
local progress = vim.lsp.util.get_progress_messages()[1]
|
||||
return {
|
||||
fg = progress and "yellow" or "green",
|
||||
bg = "gray",
|
||||
style = "bold",
|
||||
}
|
||||
end,
|
||||
left_sep = "",
|
||||
right_sep = "block",
|
||||
}
|
||||
|
||||
component.file_type = {
|
||||
provider = {
|
||||
name = "file_type",
|
||||
opts = {
|
||||
filetype_icon = true,
|
||||
},
|
||||
},
|
||||
hl = {
|
||||
fg = "fg",
|
||||
bg = "gray",
|
||||
},
|
||||
left_sep = "block",
|
||||
right_sep = "block",
|
||||
}
|
||||
|
||||
component.scroll_bar = {
|
||||
provider = function()
|
||||
local chars = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
}
|
||||
local line_ratio = vim.api.nvim_win_get_cursor(0)[1] / vim.api.nvim_buf_line_count(0)
|
||||
local position = math.floor(line_ratio * 100)
|
||||
|
||||
if position <= 5 then
|
||||
position = " TOP"
|
||||
elseif position >= 95 then
|
||||
position = " BOT"
|
||||
else
|
||||
position = chars[math.floor(line_ratio * #chars)] .. position
|
||||
end
|
||||
return position
|
||||
end,
|
||||
hl = function()
|
||||
local position = math.floor(vim.api.nvim_win_get_cursor(0)[1] / vim.api.nvim_buf_line_count(0) * 100)
|
||||
local fg
|
||||
local style
|
||||
|
||||
if position <= 5 then
|
||||
fg = "aqua"
|
||||
style = "bold"
|
||||
elseif position >= 95 then
|
||||
fg = "red"
|
||||
style = "bold"
|
||||
else
|
||||
fg = "purple"
|
||||
style = nil
|
||||
end
|
||||
return {
|
||||
fg = fg,
|
||||
style = "bold",
|
||||
bg = "bg",
|
||||
}
|
||||
end,
|
||||
left_sep = "block",
|
||||
right_sep = "block",
|
||||
}
|
||||
|
||||
local left = {
|
||||
component.vim_mode,
|
||||
}
|
||||
local middle = {}
|
||||
local right = {
|
||||
component.file_type,
|
||||
component.lsp,
|
||||
component.git_branch,
|
||||
component.git_add,
|
||||
component.git_delete,
|
||||
component.git_change,
|
||||
component.separator,
|
||||
component.diagnostic_errors,
|
||||
component.diagnostic_warnings,
|
||||
component.diagnostic_info,
|
||||
component.diagnostic_hints,
|
||||
component.scroll_bar,
|
||||
}
|
||||
|
||||
local components = {
|
||||
active = {
|
||||
left,
|
||||
middle,
|
||||
right,
|
||||
},
|
||||
}
|
||||
|
||||
feline.setup({
|
||||
components = components,
|
||||
theme = theme,
|
||||
vi_mode_colors = mode_theme,
|
||||
})
|
||||
|
||||
---vim:filetype=lua
|
||||
|
@ -1,5 +1,6 @@
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
local term = require("harpoon.term")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
@ -9,3 +10,5 @@ vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
|
||||
|
||||
vim.keymap.set("n", "<leader>t", function() term.gotoTerminal(1) end)
|
||||
|
@ -1,3 +1,4 @@
|
||||
require("jabuxas.remap")
|
||||
require("jabuxas.set")
|
||||
require("jabuxas.bar")
|
||||
require("jabuxas.packer")
|
||||
|
@ -1,21 +1,26 @@
|
||||
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Only required if you have packer configured as `opt`
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Simple plugins can be specified as strings
|
||||
use 'rstacruz/vim-closer'
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.0',
|
||||
-- or , branch = '0.1.x',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
|
||||
use({
|
||||
'rose-pine/neovim',
|
||||
as = 'rose-pine',
|
||||
@ -23,14 +28,11 @@ return require('packer').startup(function(use)
|
||||
vim.cmd('colorscheme rose-pine')
|
||||
end
|
||||
})
|
||||
|
||||
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||
|
||||
use('nvim-treesitter/playground')
|
||||
use('theprimeagen/harpoon')
|
||||
use('mbbill/undotree')
|
||||
use('tpope/vim-fugitive')
|
||||
|
||||
use({
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
@ -38,7 +40,6 @@ return require('packer').startup(function(use)
|
||||
end,
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
})
|
||||
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
@ -46,7 +47,6 @@ return require('packer').startup(function(use)
|
||||
},
|
||||
tag = 'nightly' -- optional, updated every week. (see issue #1193)
|
||||
}
|
||||
|
||||
use {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
requires = {
|
||||
@ -54,7 +54,6 @@ return require('packer').startup(function(use)
|
||||
{'neovim/nvim-lspconfig'},
|
||||
{'williamboman/mason.nvim'},
|
||||
{'williamboman/mason-lspconfig.nvim'},
|
||||
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'},
|
||||
{'hrsh7th/cmp-buffer'},
|
||||
@ -62,27 +61,42 @@ return require('packer').startup(function(use)
|
||||
{'saadparwaiz1/cmp_luasnip'},
|
||||
{'hrsh7th/cmp-nvim-lsp'},
|
||||
{'hrsh7th/cmp-nvim-lua'},
|
||||
|
||||
-- Snippets
|
||||
{'L3MON4D3/LuaSnip'},
|
||||
-- Snippet Collection (Optional)
|
||||
{'rafamadriz/friendly-snippets'},
|
||||
}
|
||||
}
|
||||
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
|
||||
use 'nvim-tree/nvim-web-devicons'
|
||||
use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'}
|
||||
|
||||
use 'feline-nvim/feline.nvim'
|
||||
use 'xiyaowong/nvim-transparent'
|
||||
|
||||
use 'windwp/nvim-autopairs'
|
||||
|
||||
-- use({
|
||||
-- 'nyoom-engineering/oxocarbon.nvim',
|
||||
-- as = 'oxocarbon',
|
||||
-- config = function()
|
||||
-- vim.opt.background = "dark"
|
||||
-- vim.cmd('colorscheme oxocarbon')
|
||||
-- end
|
||||
-- })
|
||||
--
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- -- Automatically source and re-compile packer whenever you save this init.lua
|
||||
-- local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
|
||||
-- vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
-- command = 'source <afile> | silent! LspStop | silent! LspStart | PackerCompile',
|
||||
-- group = packer_group,
|
||||
-- pattern = vim.fn.expand '$MYVIMRC',
|
||||
-- })
|
||||
|
@ -31,3 +31,5 @@ vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
|
||||
vim.keymap.set("t", "<leader><Esc>", [[<C-\><C-n>]])
|
||||
|
@ -1,4 +1,5 @@
|
||||
vim.opt.guicursor = ""
|
||||
-- vim.opt.guicursor = ""
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
@ -35,3 +36,7 @@ vim.g.mapleader = " "
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Case insensitive searching UNLESS /C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
vim.o.smartcase = true
|
||||
|
Loading…
Reference in New Issue
Block a user