more updates <3

This commit is contained in:
Solomon Laing 2023-01-06 08:45:23 +10:30
parent 3cde4213f1
commit 39df20ed1f
4 changed files with 148 additions and 131 deletions

View File

@ -1,3 +1,7 @@
-- require "user.bufferline" -- unused
-- require "user.noice" -- unused
-- require "user.winbar" -- top bar, unused
require "user.impatient" -- good leading
require "user.options" -- my options
require "user.keymaps" -- misc keymaps not part of whichkey
@ -28,8 +32,10 @@ require "user.todo-comments" -- highlight TODO and other related comments
require "user.treesitter" -- magic
require "user.whichkey" -- keymaps
require "user.spectre" -- renaming but better
require "user.winbar" -- top bar
require "user.cybu" -- cycle through current buffers
require "user.dap" -- debugging
require "user.lspsaga" -- bit overkill, using for code action menu
require "user.neogen" -- annotation/doc generator
-- winbar plugin aint working with navic, this could, but I'm using lualine.
-- vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"

View File

@ -1,105 +1,113 @@
local colors = {
red = '#ca1243',
grey = '#a0a1a7',
black = '#383a42',
white = '#f3f3f3',
light_green = '#83a598',
orange = '#fe8019',
green = '#8ec07c',
red = "#ca1243",
grey = "#a0a1a7",
black = "#383a42",
white = "#f3f3f3",
light_green = "#83a598",
orange = "#fe8019",
green = "#8ec07c",
}
-- Put proper separators and gaps between components in sections
local function process_sections(sections)
for name, section in pairs(sections) do
local left = name:sub(9, 10) < 'x'
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
end
for id, comp in ipairs(section) do
if type(comp) ~= 'table' then
comp = { comp }
section[id] = comp
end
comp.separator = left and { right = '' } or { left = '' }
end
end
return sections
for name, section in pairs(sections) do
local left = name:sub(9, 10) < "x"
for pos = 1, name ~= "lualine_z" and #section or #section - 1 do
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
end
for id, comp in ipairs(section) do
if type(comp) ~= "table" then
comp = { comp }
section[id] = comp
end
comp.separator = left and { right = "" } or { left = "" }
end
end
return sections
end
local function search_result()
-- if vim.v.hlsearch == 0 then
-- return ''
-- end
-- local last_search = vim.fn.getreg('/')
-- if not last_search or last_search == '' then
-- return ''
-- end
-- local searchcount = vim.fn.searchcount { maxcount = 9999 }
-- return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
return ''
if vim.v.hlsearch == 0 then
return ''
end
local last_search = vim.fn.getreg('/')
if not last_search or last_search == '' then
return ''
end
local searchcount = vim.fn.searchcount { maxcount = 9999 }
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
-- return ""
end
local function modified()
if vim.bo.modified then
return '+'
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
return '-'
end
return ''
if vim.bo.modified then
return "+"
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
return "-"
end
return ""
end
require('lualine').setup {
options = {
theme = 'gruvbox',
component_separators = '',
section_separators = { left = '', right = '' },
},
sections = process_sections {
lualine_a = { 'mode' },
lualine_b = {
'branch',
'diff',
{
'diagnostics',
source = { 'nvim' },
sections = { 'error' },
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
},
{
'diagnostics',
source = { 'nvim' },
sections = { 'warn' },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
},
{ 'filename', file_status = false, path = 1 },
{ modified, color = { bg = colors.red } },
{
'%w',
cond = function()
return vim.wo.previewwindow
end,
},
{
'%r',
cond = function()
return vim.bo.readonly
end,
},
{
'%q',
cond = function()
return vim.bo.buftype == 'quickfix'
end,
},
},
lualine_c = {},
lualine_x = {},
-- lualine_y = { search_result, 'filetype' },
lualine_y = { 'filetype' },
lualine_z = { '%l:%c', '%p%%/%L' },
},
inactive_sections = {
lualine_c = { '%f %y %m' },
lualine_x = {},
},
}
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
print("navic error!")
return
end
require("lualine").setup({
options = {
theme = "gruvbox",
component_separators = "",
section_separators = { left = "", right = "" },
},
sections = process_sections({
lualine_a = { "mode" },
lualine_b = {
"branch",
"diff",
{
"diagnostics",
source = { "nvim" },
sections = { "error" },
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
},
{
"diagnostics",
source = { "nvim" },
sections = { "warn" },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
},
{ "filename", file_status = false, path = 1 },
{ modified, color = { bg = colors.red } },
{
"%w",
cond = function()
return vim.wo.previewwindow
end,
},
{
"%r",
cond = function()
return vim.bo.readonly
end,
},
{
"%q",
cond = function()
return vim.bo.buftype == "quickfix"
end,
},
},
lualine_c = {
{ navic.get_location, cond = navic.is_available },
},
lualine_x = {},
-- lualine_y = { search_result, 'filetype' },
lualine_y = { "filetype " },
lualine_z = { "%l:%c", "%p%%/%L" },
}),
inactive_sections = {
lualine_c = { "%f %y %m" },
lualine_x = {},
},
})

View File

@ -1,42 +1,43 @@
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
print("navic error!")
return
print("navic error!")
return
end
local icons = require "user.icons"
local icons = require("user.icons")
navic.setup {
icons = {
File = icons.kind.File,
Module = icons.kind.Module,
Namespace = icons.kind.Namespace,
Package = icons.ui.Package,
Class = icons.kind.Class,
Method = icons.kind.Method,
Property = icons.kind.Property,
Field = icons.kind.Field,
Constructor = icons.kind.Constructor,
Enum = icons.kind.Enum,
Interface = icons.kind.Interface,
Function = icons.kind.Function,
Variable = icons.kind.Variable,
Constant = icons.kind.Constant,
String = icons.type.String,
Number = icons.type.Number,
Boolean = icons.type.Boolean,
Array = icons.type.Array,
Object = icons.type.Object,
Key = icons.kind.Key,
Null = icons.type.Null,
EnumMember = icons.kind.EnumMember,
Struct = icons.kind.Struct,
Event = icons.kind.Event,
Operator = icons.kind.Operator,
TypeParameter = icons.kind.TypeParameter
},
highlight = true,
separator = " " .. icons.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
}
navic.setup({
icons = {
File = icons.kind.File .. " ",
Module = icons.kind.Module .. " ",
Namespace = icons.kind.Namespace .. " ",
Package = icons.ui.Package .. " ",
Class = icons.kind.Class .. " ",
Method = icons.kind.Method .. " ",
Property = icons.kind.Property .. " ",
Field = icons.kind.Field .. " ",
Constructor = icons.kind.Constructor .. " ",
Enum = icons.kind.Enum .. " ",
Interface = icons.kind.Interface .. " ",
Function = icons.kind.Function .. " ",
Variable = icons.kind.Variable .. " ",
Constant = icons.kind.Constant .. " ",
String = icons.type.String .. " ",
Number = icons.type.Number .. " ",
Boolean = icons.type.Boolean .. " ",
Array = icons.type.Array .. " ",
Object = icons.type.Object .. " ",
Key = icons.kind.Key .. " ",
Null = icons.type.Null .. " ",
EnumMember = icons.kind.EnumMember .. " ",
Struct = icons.kind.Struct .. " ",
Event = icons.kind.Event .. " ",
Operator = icons.kind.Operator .. " ",
TypeParameter = icons.kind.TypeParameter .. " ",
},
highlight = false,
separator = " > ",
depth_limit = 0,
depth_limit_indicator = "..",
safe_output = true,
})

View File

@ -105,6 +105,7 @@ return packer.startup(function(use)
use("ghillb/cybu.nvim")
use("mbbill/undotree")
use("MunifTanjim/nui.nvim")
-- noice
-- Icons
use("kyazdani42/nvim-web-devicons")
@ -114,7 +115,8 @@ return packer.startup(function(use)
use("rcarriga/nvim-dap-ui")
-- Tabline
use("fgheng/winbar.nvim")
-- use("fgheng/winbar.nvim")
-- bufferline
-- Statusline
use("nvim-lualine/lualine.nvim")