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.impatient" -- good leading
require "user.options" -- my options require "user.options" -- my options
require "user.keymaps" -- misc keymaps not part of whichkey 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.treesitter" -- magic
require "user.whichkey" -- keymaps require "user.whichkey" -- keymaps
require "user.spectre" -- renaming but better require "user.spectre" -- renaming but better
require "user.winbar" -- top bar
require "user.cybu" -- cycle through current buffers require "user.cybu" -- cycle through current buffers
require "user.dap" -- debugging require "user.dap" -- debugging
require "user.lspsaga" -- bit overkill, using for code action menu require "user.lspsaga" -- bit overkill, using for code action menu
require "user.neogen" -- annotation/doc generator 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 = { local colors = {
red = '#ca1243', red = "#ca1243",
grey = '#a0a1a7', grey = "#a0a1a7",
black = '#383a42', black = "#383a42",
white = '#f3f3f3', white = "#f3f3f3",
light_green = '#83a598', light_green = "#83a598",
orange = '#fe8019', orange = "#fe8019",
green = '#8ec07c', green = "#8ec07c",
} }
-- Put proper separators and gaps between components in sections -- Put proper separators and gaps between components in sections
local function process_sections(sections) local function process_sections(sections)
for name, section in pairs(sections) do for name, section in pairs(sections) do
local left = name:sub(9, 10) < 'x' local left = name:sub(9, 10) < "x"
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do 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 } }) table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
end end
for id, comp in ipairs(section) do for id, comp in ipairs(section) do
if type(comp) ~= 'table' then if type(comp) ~= "table" then
comp = { comp } comp = { comp }
section[id] = comp section[id] = comp
end end
comp.separator = left and { right = '' } or { left = '' } comp.separator = left and { right = "" } or { left = "" }
end end
end end
return sections return sections
end end
local function search_result() local function search_result()
-- if vim.v.hlsearch == 0 then if vim.v.hlsearch == 0 then
-- return '' return ''
-- end end
-- local last_search = vim.fn.getreg('/') local last_search = vim.fn.getreg('/')
-- if not last_search or last_search == '' then if not last_search or last_search == '' then
-- return '' return ''
-- end end
-- local searchcount = vim.fn.searchcount { maxcount = 9999 } local searchcount = vim.fn.searchcount { maxcount = 9999 }
-- return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')' return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
return '' -- return ""
end end
local function modified() local function modified()
if vim.bo.modified then if vim.bo.modified then
return '+' return "+"
elseif vim.bo.modifiable == false or vim.bo.readonly == true then elseif vim.bo.modifiable == false or vim.bo.readonly == true then
return '-' return "-"
end end
return '' return ""
end end
require('lualine').setup { local status_ok, navic = pcall(require, "nvim-navic")
options = { if not status_ok then
theme = 'gruvbox', print("navic error!")
component_separators = '', return
section_separators = { left = '', right = '' }, end
},
sections = process_sections { require("lualine").setup({
lualine_a = { 'mode' }, options = {
lualine_b = { theme = "gruvbox",
'branch', component_separators = "",
'diff', section_separators = { left = "", right = "" },
{ },
'diagnostics', sections = process_sections({
source = { 'nvim' }, lualine_a = { "mode" },
sections = { 'error' }, lualine_b = {
diagnostics_color = { error = { bg = colors.red, fg = colors.white } }, "branch",
}, "diff",
{ {
'diagnostics', "diagnostics",
source = { 'nvim' }, source = { "nvim" },
sections = { 'warn' }, sections = { "error" },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } }, diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
}, },
{ 'filename', file_status = false, path = 1 }, {
{ modified, color = { bg = colors.red } }, "diagnostics",
{ source = { "nvim" },
'%w', sections = { "warn" },
cond = function() diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
return vim.wo.previewwindow },
end, { "filename", file_status = false, path = 1 },
}, { modified, color = { bg = colors.red } },
{ {
'%r', "%w",
cond = function() cond = function()
return vim.bo.readonly return vim.wo.previewwindow
end, end,
}, },
{ {
'%q', "%r",
cond = function() cond = function()
return vim.bo.buftype == 'quickfix' return vim.bo.readonly
end, end,
}, },
}, {
lualine_c = {}, "%q",
lualine_x = {}, cond = function()
-- lualine_y = { search_result, 'filetype' }, return vim.bo.buftype == "quickfix"
lualine_y = { 'filetype' }, end,
lualine_z = { '%l:%c', '%p%%/%L' }, },
}, },
inactive_sections = { lualine_c = {
lualine_c = { '%f %y %m' }, { navic.get_location, cond = navic.is_available },
lualine_x = {}, },
}, 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") local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then if not status_ok then
print("navic error!") print("navic error!")
return return
end end
local icons = require "user.icons" local icons = require("user.icons")
navic.setup { navic.setup({
icons = { icons = {
File = icons.kind.File, File = icons.kind.File .. " ",
Module = icons.kind.Module, Module = icons.kind.Module .. " ",
Namespace = icons.kind.Namespace, Namespace = icons.kind.Namespace .. " ",
Package = icons.ui.Package, Package = icons.ui.Package .. " ",
Class = icons.kind.Class, Class = icons.kind.Class .. " ",
Method = icons.kind.Method, Method = icons.kind.Method .. " ",
Property = icons.kind.Property, Property = icons.kind.Property .. " ",
Field = icons.kind.Field, Field = icons.kind.Field .. " ",
Constructor = icons.kind.Constructor, Constructor = icons.kind.Constructor .. " ",
Enum = icons.kind.Enum, Enum = icons.kind.Enum .. " ",
Interface = icons.kind.Interface, Interface = icons.kind.Interface .. " ",
Function = icons.kind.Function, Function = icons.kind.Function .. " ",
Variable = icons.kind.Variable, Variable = icons.kind.Variable .. " ",
Constant = icons.kind.Constant, Constant = icons.kind.Constant .. " ",
String = icons.type.String, String = icons.type.String .. " ",
Number = icons.type.Number, Number = icons.type.Number .. " ",
Boolean = icons.type.Boolean, Boolean = icons.type.Boolean .. " ",
Array = icons.type.Array, Array = icons.type.Array .. " ",
Object = icons.type.Object, Object = icons.type.Object .. " ",
Key = icons.kind.Key, Key = icons.kind.Key .. " ",
Null = icons.type.Null, Null = icons.type.Null .. " ",
EnumMember = icons.kind.EnumMember, EnumMember = icons.kind.EnumMember .. " ",
Struct = icons.kind.Struct, Struct = icons.kind.Struct .. " ",
Event = icons.kind.Event, Event = icons.kind.Event .. " ",
Operator = icons.kind.Operator, Operator = icons.kind.Operator .. " ",
TypeParameter = icons.kind.TypeParameter TypeParameter = icons.kind.TypeParameter .. " ",
}, },
highlight = true, highlight = false,
separator = " " .. icons.ui.ChevronRight .. " ", separator = " > ",
depth_limit = 0, depth_limit = 0,
depth_limit_indicator = "..", depth_limit_indicator = "..",
} safe_output = true,
})

View File

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