
* refactor: remove extra themes * feat: clean up theme setup * refactor: move highlights/colors to galaxyline plugin * feat: add lualine sections * feat: add lualine icons * feat: add user config override for lualine * refactor: remove galaxy line :D * refactor: clean out notify-nvim configs * refactor: clean up utils * refactor: clean up utils - icons
62 lines
1.1 KiB
Lua
62 lines
1.1 KiB
Lua
local M = {}
|
|
|
|
function M.map(mode, lhs, rhs, opts)
|
|
local defaults = {
|
|
silent = true,
|
|
noremap = true,
|
|
}
|
|
vim.keymap.set(mode, lhs, rhs, M.merge(defaults, opts or {}))
|
|
end
|
|
|
|
function M.merge_list(tbl1, tbl2)
|
|
for _, v in ipairs(tbl2) do
|
|
table.insert(tbl1, v)
|
|
end
|
|
return tbl1
|
|
end
|
|
|
|
function M.merge(...)
|
|
return vim.tbl_deep_extend('force', ...)
|
|
end
|
|
|
|
function M.split(str, sep)
|
|
local res = {}
|
|
for w in str:gmatch('([^' .. sep .. ']*)') do
|
|
if w ~= '' then
|
|
table.insert(res, w)
|
|
end
|
|
end
|
|
return res
|
|
end
|
|
|
|
function M.get_short_file_path(path)
|
|
local dirs = {}
|
|
for dir in string.gmatch(path, '([^/]+)') do
|
|
table.insert(dirs, dir)
|
|
end
|
|
|
|
local n = #dirs
|
|
if n > 3 then
|
|
return '../' .. dirs[n - 2] .. '/' .. dirs[n - 1] .. '/' .. dirs[n]
|
|
end
|
|
|
|
return path
|
|
end
|
|
|
|
function M.get_short_cwd()
|
|
local parts = vim.split(vim.fn.getcwd(), '/')
|
|
return parts[#parts]
|
|
end
|
|
|
|
function M.diff_source()
|
|
local gitsigns = vim.b.gitsigns_status_dict
|
|
if gitsigns then
|
|
return {
|
|
added = gitsigns.added,
|
|
modified = gitsigns.changed,
|
|
removed = gitsigns.removed,
|
|
}
|
|
end
|
|
end
|
|
|
|
return M
|