Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lua/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function Highlights:get()
local colors = require("catppuccin.palettes").get_palette("mocha")
local cursor_line_bg = helpers:blend(colors.mauve, "#000000", 0.28)

---@type table<string, vim.api.keyset.highlight>
local highlights = {
Visual = { bg = helpers:blend(colors.mauve, "#000000", 0.4) },
CursorLine = { bg = cursor_line_bg },
Expand All @@ -55,6 +56,10 @@ function Highlights:get()
NavicText = { link = "lualine_c_inactive" },
NavicSeparator = { link = "lualine_c_inactive" },

-- Statusline
OverlayActive = { bg = colors.surface1 },
OverlayActiveInverted = { fg = colors.surface1 },

-- LSP
LspReferenceText = { underline = true },
["@tag.builtin"] = { link = "Special" },
Expand Down
28 changes: 23 additions & 5 deletions lua/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,33 @@ keymaps:add_multiple({
{
"n",
"[e",
function() vim.diagnostic.jump({ count = -vim.v.count1, severity = "ERROR" }) end,
function()
vim.diagnostic.jump({ count = -vim.v.count1, severity = vim.diagnostic.severity.ERROR })
end,
{ desc = "Previous error" },
},
{
"n",
"]e",
function() vim.diagnostic.jump({ count = vim.v.count1, severity = "ERROR" }) end,
function()
vim.diagnostic.jump({ count = vim.v.count1, severity = vim.diagnostic.severity.ERROR })
end,
{ desc = "Next error" },
},
{
"n",
"[w",
function() vim.diagnostic.jump({ count = -vim.v.count1, severity = "WARN" }) end,
function()
vim.diagnostic.jump({ count = -vim.v.count1, severity = vim.diagnostic.severity.WARN })
end,
{ desc = "Previous warning" },
},
{
"n",
"]w",
function() vim.diagnostic.jump({ count = vim.v.count1, severity = "WARN" }) end,
function()
vim.diagnostic.jump({ count = vim.v.count1, severity = vim.diagnostic.severity.WARN })
end,
{ desc = "Next warning" },
},
})
Expand Down Expand Up @@ -198,7 +206,17 @@ keymaps:add_multiple({
{
"n",
"<leader>lr",
function() vim.lsp.buf.rename() end,
function()
vim.notify("🪚 ⭐")
vim.lsp.buf.rename(nil, {
---@type snacks.input.Config
snacks = {
win = {
relative = "cursor",
},
},
})
end,
{ desc = "Rename current symbol", lsp = { method = "textDocument/rename" } },
},
{
Expand Down
20 changes: 0 additions & 20 deletions lua/nikero/lualine.lua

This file was deleted.

77 changes: 77 additions & 0 deletions lua/nikero/statusline.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---@class StatusLine
---@field statusline_icon_hl fun(self: StatusLine, icon_hl: string, default_hl_token: string): string
local StatusLine = {}

function StatusLine:statusline_icon_hl(icon_hl, default_hl_token)
local base_hl = default_hl_token:match("%%#(.-)#") or default_hl_token
local group = ("Nikero_%s_%s"):format(base_hl, icon_hl):gsub("[^%w_]", "_")
local icon = vim.api.nvim_get_hl(0, { name = group, link = false })

if next(icon) ~= nil then return group end

local base = vim.api.nvim_get_hl(0, { name = base_hl, link = false })
local new_icon = vim.api.nvim_get_hl(0, { name = icon_hl, link = false })

vim.api.nvim_set_hl(0, group, { fg = new_icon.fg, bg = base.bg })

return group
end
Comment thread
coderabbitai[bot] marked this conversation as resolved.

function StatusLine:harpoon_item(default_hl, active_index)
return function(index, item)
local file_path = vim.fn.fnamemodify(item.value, ":p")
local icon, base_icon_hl = require("mini.icons").get("file", file_path)

local is_active = index == active_index
local base_hl = default_hl
if is_active then base_hl = "%#OverlayActive#" end

local icon_hl = self:statusline_icon_hl(base_icon_hl, base_hl)
local icon_str = self:wrap(icon_hl, icon) .. base_hl

local value = string.format("%s %d", icon_str, index)

if is_active then
local side_hl = self:statusline_icon_hl("OverlayActiveInverted", default_hl)
value = self:wrap(side_hl, "") .. value .. self:wrap(side_hl, "") .. default_hl
else
value = string.format(" %s ", value)
end

return value
end
end

local MAX_DISPLAYED_WIDGETS = 3

function StatusLine:harpoon_widget(default_hl)
local current_file = vim.fn.expand("%:p")
local items = require("harpoon"):list().items

local active_index = vim.iter(ipairs(items)):find(
function(_, item) return vim.fn.fnamemodify(item.value, ":p") == current_file end
)

local start_index = 1
if #items > MAX_DISPLAYED_WIDGETS and active_index >= MAX_DISPLAYED_WIDGETS - 1 then
start_index = math.min(math.max(active_index - 1, 0), #items - MAX_DISPLAYED_WIDGETS + 1)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
end

local widgets = vim
.iter(ipairs(items))
:skip(start_index - 1)
:take(MAX_DISPLAYED_WIDGETS)
:map(self:harpoon_item(default_hl, active_index))
:join("")

if start_index ~= 1 then widgets = string.gsub(widgets, "^%s", "<") end
if start_index ~= #items - MAX_DISPLAYED_WIDGETS + 1 then
widgets = string.gsub(widgets, "%s$", ">")
end
Comment thread
coderabbitai[bot] marked this conversation as resolved.

return widgets
end

function StatusLine:wrap(hl, text) return "%#" .. hl .. "#" .. text end

return StatusLine
2 changes: 1 addition & 1 deletion lua/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ vim.diagnostic.config({
jump = {
on_jump = function(diagnostic, buffer)
if not diagnostic then return end
vim.diagnostic.open_float(buffer or 0, { scope = "cursor", focus = false })
vim.diagnostic.open_float({ bufnr = buffer, scope = "cursor", focus = false })
end,
},
float = {
Expand Down
16 changes: 0 additions & 16 deletions lua/plugins/colorschemes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,6 @@ return {
opts = {
flavour = "mocha",
auto_integrations = true,
integrations = {
lualine = {
all = function(colors)
return {
normal = {
c = { bg = colors.base, fg = colors.text },
},
inactive = {
a = { bg = colors.base, fg = colors.blue },
b = { bg = colors.base, fg = colors.surface1, gui = "bold" },
c = { bg = colors.base, fg = colors.overlay0 },
},
}
end,
},
},
transparent_background = require("nikero.config").transparency,
dim_inactive = {
enabled = true,
Expand Down
15 changes: 6 additions & 9 deletions lua/plugins/harpoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@ return {
end,
desc = "Toggle Harpoon",
},
{
"<leader>ha",
function()
require("harpoon"):list():add()
require("lualine").refresh()
end,
desc = "Add file to Harpoon",
},
{ "<leader>ha", function() require("harpoon"):list():add() end, desc = "Add file to Harpoon" },
{ "<C-p>", function() require("harpoon"):list():prev() end, desc = "Previous Harpoon file" },
{ "<C-n>", function() require("harpoon"):list():next() end, desc = "Next Harpoon file" },
{ "<M-z>", function() require("harpoon"):list():select(1) end, desc = "Goto 1 of mark" },
Expand All @@ -36,7 +29,6 @@ return {
:enumerate()
:find(function(_, item) return string.find(buf_name, item.value, 1, true) end)
list:remove_at(index)
require("lualine").refresh()
end,
desc = "Remove current buffer from Harpoon",
},
Expand Down Expand Up @@ -78,6 +70,11 @@ return {
{ buf = cx.bufnr }
)
end,
ADD = function() require("lualine").refresh() end,
REMOVE = function() require("lualine").refresh() end,
REORDER = function() require("lualine").refresh() end,
POSITION_UPDATED = function() require("lualine").refresh() end,
LIST_CHANGE = function() require("lualine").refresh() end,
})
end,
}
3 changes: 2 additions & 1 deletion lua/plugins/language/support.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ return {
end,
},
},
---@module "mason-lspconfig"
---@type MasonLspconfigSettings
opts = {
automatic_enable = {
Expand All @@ -49,7 +50,7 @@ return {
"mason-org/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
build = ":MasonUpdate",
---@module 'mason'
---@module "mason"
---@type MasonSettings
opts = {
ui = {
Expand Down
Loading
Loading