Refactoring

- Added macos
This commit is contained in:
foozzi 2024-01-14 23:29:33 -05:00
parent 03a7616e8c
commit 2c1ccaffd1
47 changed files with 76 additions and 33 deletions

View file

@ -0,0 +1,18 @@
local M = {}
M.debugging_signs = {
Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" },
Breakpoint = "",
BreakpointCondition = "",
BreakpointRejected = { "", "DiagnosticError" },
LogPoint = ".>",
}
M.diagnostic_signs = {
Error = "",
Warn = "",
Hint = "",
Info = "",
}
return M

View file

@ -0,0 +1,26 @@
local M = {}
function M.tabline()
local s = ""
for i = 1, vim.fn.tabpagenr("$") do
local winnr = vim.fn.tabpagewinnr(i)
local buflist = vim.fn.tabpagebuflist(i)
local bufnr = buflist[winnr]
local bufname = vim.fn.bufname(bufnr)
local filename = vim.fn.fnamemodify(bufname, ":t")
local icon = require("nvim-web-devicons").get_icon(filename)
-- Отмечаем активный таб
if i == vim.fn.tabpagenr() then
s = s .. "%#TabLineSel#"
else
s = s .. "%#TabLine#"
end
s = s .. " " .. (icon or "") .. " " .. filename .. " "
end
s = s .. "%#TabLineFill#%="
return s
end
return M

View file

@ -0,0 +1,69 @@
local vim_modes = {
n = "n",
i = "i",
v = "v",
}
local default_opts = {
noremap = true,
silent = true,
}
--- @param opts (table|nil)
--- @return table
local get_opts = function(opts)
local all_opts = opts
if all_opts == nil then
all_opts = {}
end
for k, v in pairs(default_opts) do
all_opts[k] = all_opts[k] or v
end
return all_opts
end
--- @param vimmode (string|nil)
--- @return string
local get_mode = function(vimmode)
local modeString = vim_modes[vimmode]
if modeString == nil then
return "n"
else
return modeString
end
end
--- @param command (string)
--- @return string
local get_cmd_string = function(command)
return [[<cmd>]] .. command .. [[<CR>]]
end
--- @param keymaps string
--- @param command string
--- @param vimmode (string|nil)
--- @param options (table|nil)
--- @return nil
local mapvimkey = function(keymaps, command, vimmode, options)
local mode = get_mode(vimmode)
local lhs = keymaps
local rhs = get_cmd_string(command)
local opts = get_opts(options)
vim.keymap.set(mode, lhs, rhs, opts)
end
--- @param keymaps string
--- @param cmd (function|string)
--- @param desc (string|nil)
--- @return table
local maplazykey = function(keymaps, cmd, desc)
if type(cmd) ~= "function" then
cmd = get_cmd_string(cmd)
end
return { keymaps, cmd, desc = desc }
end
return {
mapvimkey = mapvimkey,
maplazykey = maplazykey,
}