Qol and looks
This commit is contained in:
@@ -1,214 +1,152 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = {
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local lualine = require("lualine")
|
local lualine = require("lualine")
|
||||||
|
|
||||||
local colors = {
|
local colors = {
|
||||||
bg = "#1e1e2e",
|
bg = "#1e1e2e",
|
||||||
fg = "#cdd6f4",
|
fg = "#cdd6f4",
|
||||||
yellow = "#f9e2af",
|
yellow = "#f9e2af",
|
||||||
cyan = "#89dceb",
|
cyan = "#89dceb",
|
||||||
darkblue = "#2374f6",
|
darkblue = "#89b4fa",
|
||||||
green = "#a6e3a1",
|
green = "#a6e3a1",
|
||||||
orange = "#fab387",
|
orange = "#fab387",
|
||||||
violet = "#f5c2e7",
|
violet = "#f5c2e7",
|
||||||
magenta = "#cba6f7",
|
magenta = "#cba6f7",
|
||||||
blue = "#89b4fa",
|
blue = "#74c7ec",
|
||||||
red = "#f38ba8",
|
red = "#f38ba8",
|
||||||
}
|
}
|
||||||
|
|
||||||
local conditions = {
|
local conditions = {
|
||||||
buffer_not_empty = function()
|
|
||||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
|
||||||
end,
|
|
||||||
hide_in_width = function()
|
hide_in_width = function()
|
||||||
return vim.fn.winwidth(0) > 80
|
return vim.fn.winwidth(0) > 80
|
||||||
end,
|
end,
|
||||||
check_git_workspace = function()
|
|
||||||
local filepath = vim.fn.expand("%:p:h")
|
|
||||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
|
||||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Config
|
local mode_color = {
|
||||||
local config = {
|
n = colors.red,
|
||||||
|
i = colors.green,
|
||||||
|
v = colors.blue,
|
||||||
|
[""] = colors.blue,
|
||||||
|
V = colors.blue,
|
||||||
|
c = colors.magenta,
|
||||||
|
no = colors.red,
|
||||||
|
s = colors.orange,
|
||||||
|
S = colors.orange,
|
||||||
|
[""] = colors.orange,
|
||||||
|
ic = colors.yellow,
|
||||||
|
R = colors.violet,
|
||||||
|
Rv = colors.violet,
|
||||||
|
cv = colors.red,
|
||||||
|
ce = colors.red,
|
||||||
|
r = colors.cyan,
|
||||||
|
rm = colors.cyan,
|
||||||
|
["r?"] = colors.cyan,
|
||||||
|
["!"] = colors.red,
|
||||||
|
t = colors.red,
|
||||||
|
}
|
||||||
|
|
||||||
|
lualine.setup({
|
||||||
options = {
|
options = {
|
||||||
-- Disable sections and component separators
|
|
||||||
component_separators = "",
|
component_separators = "",
|
||||||
section_separators = "",
|
section_separators = { left = "", right = "" },
|
||||||
theme = {
|
|
||||||
-- We are going to use lualine_c an lualine_x as left and
|
|
||||||
-- right section. Both are highlighted by c theme . So we
|
|
||||||
-- are just setting default looks o statusline
|
|
||||||
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
|
||||||
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
-- these are to remove the defaults
|
lualine_a = {
|
||||||
lualine_a = {},
|
{
|
||||||
lualine_b = {},
|
"mode",
|
||||||
lualine_y = {},
|
separator = { left = "" },
|
||||||
lualine_z = {},
|
right_padding = 2,
|
||||||
-- These will be filled later
|
color = function()
|
||||||
lualine_c = {},
|
return { bg = mode_color[vim.fn.mode()], fg = colors.bg }
|
||||||
lualine_x = {},
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_b = {
|
||||||
|
{
|
||||||
|
"filename",
|
||||||
|
color = { fg = colors.magenta, gui = "bold" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"branch",
|
||||||
|
icon = "",
|
||||||
|
color = { fg = colors.violet, gui = "bold" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
"diagnostics",
|
||||||
|
sources = { "nvim_diagnostic" },
|
||||||
|
symbols = { error = " ", warn = " ", info = " " },
|
||||||
|
diagnostics_color = {
|
||||||
|
color_error = { fg = colors.red },
|
||||||
|
color_warn = { fg = colors.yellow },
|
||||||
|
color_info = { fg = colors.cyan },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
"diff",
|
||||||
|
symbols = { added = " ", modified = " ", removed = " " },
|
||||||
|
diff_color = {
|
||||||
|
added = { fg = colors.green },
|
||||||
|
modified = { fg = colors.orange },
|
||||||
|
removed = { fg = colors.red },
|
||||||
|
},
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"o:encoding",
|
||||||
|
fmt = string.upper,
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
color = { fg = colors.green, gui = "bold" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fileformat",
|
||||||
|
fmt = string.upper,
|
||||||
|
color = { fg = colors.green, gui = "bold" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
|
||||||
|
require("lazy.status").updates,
|
||||||
|
cond = require("lazy.status").has_updates,
|
||||||
|
color = { fg = colors.violet },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_y = {
|
||||||
|
{
|
||||||
|
"filetype",
|
||||||
|
color = { fg = colors.darkblue },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"progress",
|
||||||
|
color = { fg = colors.magenta },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_z = {
|
||||||
|
{
|
||||||
|
"location",
|
||||||
|
separator = { right = "" },
|
||||||
|
left_padding = 2,
|
||||||
|
color = function()
|
||||||
|
return { bg = mode_color[vim.fn.mode()], fg = colors.bg }
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
-- these are to remove the defaults
|
lualine_a = { "filename" },
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {},
|
|
||||||
lualine_c = {},
|
lualine_c = {},
|
||||||
lualine_x = {},
|
lualine_x = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = { "location" },
|
||||||
},
|
},
|
||||||
}
|
tabline = {},
|
||||||
|
extensions = {},
|
||||||
-- Inserts a component in lualine_c at left section
|
|
||||||
local function ins_left(component)
|
|
||||||
table.insert(config.sections.lualine_c, component)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Inserts a component in lualine_x at right section
|
|
||||||
local function ins_right(component)
|
|
||||||
table.insert(config.sections.lualine_x, component)
|
|
||||||
end
|
|
||||||
|
|
||||||
ins_left({
|
|
||||||
function()
|
|
||||||
return "▊"
|
|
||||||
end,
|
|
||||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
|
||||||
padding = { left = 0, right = 1 }, -- We don't need space before this
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ins_left({
|
|
||||||
-- mode component
|
|
||||||
function()
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
color = function()
|
|
||||||
-- auto change color according to neovims mode
|
|
||||||
local mode_color = {
|
|
||||||
n = colors.red,
|
|
||||||
i = colors.green,
|
|
||||||
v = colors.blue,
|
|
||||||
[""] = colors.blue,
|
|
||||||
V = colors.blue,
|
|
||||||
c = colors.magenta,
|
|
||||||
no = colors.red,
|
|
||||||
s = colors.orange,
|
|
||||||
S = colors.orange,
|
|
||||||
[""] = colors.orange,
|
|
||||||
ic = colors.yellow,
|
|
||||||
R = colors.violet,
|
|
||||||
Rv = colors.violet,
|
|
||||||
cv = colors.red,
|
|
||||||
ce = colors.red,
|
|
||||||
r = colors.cyan,
|
|
||||||
rm = colors.cyan,
|
|
||||||
["r?"] = colors.cyan,
|
|
||||||
["!"] = colors.red,
|
|
||||||
t = colors.red,
|
|
||||||
}
|
|
||||||
return { fg = mode_color[vim.fn.mode()] }
|
|
||||||
end,
|
|
||||||
padding = { right = 1 },
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_left({
|
|
||||||
-- filesize component
|
|
||||||
"filesize",
|
|
||||||
cond = conditions.buffer_not_empty,
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_left({
|
|
||||||
"filename",
|
|
||||||
cond = conditions.buffer_not_empty,
|
|
||||||
color = { fg = colors.magenta, gui = "bold" },
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_left({ "location" })
|
|
||||||
|
|
||||||
ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
|
|
||||||
|
|
||||||
ins_left({
|
|
||||||
"diagnostics",
|
|
||||||
sources = { "nvim_diagnostic" },
|
|
||||||
symbols = { error = " ", warn = " ", info = " " },
|
|
||||||
diagnostics_color = {
|
|
||||||
color_error = { fg = colors.red },
|
|
||||||
color_warn = { fg = colors.yellow },
|
|
||||||
color_info = { fg = colors.cyan },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Insert mid section. You can make any number of sections in neovim :)
|
|
||||||
-- for lualine it's any number greater then 2
|
|
||||||
ins_left({
|
|
||||||
function()
|
|
||||||
return "%="
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_right({
|
|
||||||
-- Lsp server name .
|
|
||||||
function()
|
|
||||||
local msg = "No Active Lsp"
|
|
||||||
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,
|
|
||||||
icon = " :",
|
|
||||||
color = { fg = "#ffffff", gui = "bold" },
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Add components to right sections
|
|
||||||
ins_right({
|
|
||||||
require("lazy.status").updates,
|
|
||||||
cond = require("lazy.status").has_updates,
|
|
||||||
color = { fg = colors.violet },
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_right({
|
|
||||||
"branch",
|
|
||||||
icon = "",
|
|
||||||
color = { fg = colors.violet, gui = "bold" },
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_right({
|
|
||||||
"diff",
|
|
||||||
-- Is it me or the symbol for modified us really weird
|
|
||||||
symbols = { added = " ", modified = " ", removed = " " },
|
|
||||||
diff_color = {
|
|
||||||
added = { fg = colors.green },
|
|
||||||
modified = { fg = colors.orange },
|
|
||||||
removed = { fg = colors.red },
|
|
||||||
},
|
|
||||||
cond = conditions.hide_in_width,
|
|
||||||
})
|
|
||||||
|
|
||||||
ins_right({
|
|
||||||
function()
|
|
||||||
return "▊"
|
|
||||||
end,
|
|
||||||
color = { fg = colors.blue },
|
|
||||||
padding = { left = 1 },
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Now don't forget to initialize lualine
|
|
||||||
lualine.setup(config)
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ return {
|
|||||||
luasnip.lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
["<C-p>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(), -- next suggestion
|
["<C-n>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||||
@@ -68,5 +72,12 @@ return {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
||||||
|
luasnip.jump(1)
|
||||||
|
end, { silent = true })
|
||||||
|
-- vim.keymap.set({ "i", "s" }, "<C-Tab>", function()
|
||||||
|
-- luasnip.jump(-1)
|
||||||
|
-- end, { silent = true })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ return {
|
|||||||
"vim",
|
"vim",
|
||||||
"vimdoc",
|
"vimdoc",
|
||||||
"javascript",
|
"javascript",
|
||||||
|
"jsdoc",
|
||||||
"typescript",
|
"typescript",
|
||||||
"java",
|
"java",
|
||||||
"json",
|
"json",
|
||||||
|
|||||||
Reference in New Issue
Block a user