summaryrefslogtreecommitdiffstats
path: root/lua/core/misc.lua
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2025-05-06 16:51:24 -0500
committerSquibid <me@zacharyscheiman.com>2025-05-06 16:51:24 -0500
commit7c3289fded1f75f6e060f56bd06edc2a327744d9 (patch)
treebf579e6eb1de84237a74ef13ce67703c15266afe /lua/core/misc.lua
parent3094bf2a3983b375f4adeccd25c3b12bbbded2aa (diff)
downloadnvim-7c3289fded1f75f6e060f56bd06edc2a327744d9.tar.gz
nvim-7c3289fded1f75f6e060f56bd06edc2a327744d9.tar.bz2
nvim-7c3289fded1f75f6e060f56bd06edc2a327744d9.zip
kitchen sink again :(
Diffstat (limited to 'lua/core/misc.lua')
-rw-r--r--lua/core/misc.lua40
1 files changed, 10 insertions, 30 deletions
diff --git a/lua/core/misc.lua b/lua/core/misc.lua
index 5d0c0cf..d9c8613 100644
--- a/lua/core/misc.lua
+++ b/lua/core/misc.lua
@@ -9,7 +9,7 @@ M.appid = "Nvim Config"
function M.include(fn)
local ok, r = pcall(require, fn)
if not ok then
- vim.notify('Could not find "'..fn..'": '..r, vim.log.levels.WARN, { title = M.appid })
+ vim.notify("Could not find '"..fn.."': "..r, vim.log.levels.WARN, { title = M.appid })
return ok
end
return r
@@ -26,26 +26,6 @@ function M.loopf(path, body, ext)
end
end
---- set colorscheme
----@param name string name of colorscheme
-function M.colorscheme(name)
- -- only set the colorscheme if it exists
- for _, v in pairs(vim.fn.getcompletion('', 'color')) do
- if v == name then
- vim.cmd("colorscheme "..name)
- break
- end
- end
-
- -- override with any addons
- for _, v in pairs(vim.fn.getcompletion('', 'color')) do
- if v == name..'.ext' then
- vim.cmd("colorscheme"..name..'.ext')
- break
- end
- end
-end
-
--- extend vim.kemap.set
---@param mode string|table mode for the keymap
---@param bind string|table keymap
@@ -53,26 +33,26 @@ end
---@param opts vim.keymap.set.Opts? keymap options
function M.map(mode, bind, cmd, opts)
opts = opts or {}
- opts['noremap'] = true
- opts['silent'] = true
+ opts["noremap"] = true
+ opts["silent"] = true
-- attempt to autogenerate a basic description
- if not opts['desc'] then
+ if not opts["desc"] then
if type(cmd) == "string" then
- opts['desc'] = cmd:gsub("<%a+>", "")
+ opts["desc"] = cmd:gsub("<%a+>", "")
elseif type(cmd) == "function" then
-- TODO: find a way to generate a better name
local file_name = vim.fn.fnamemodify(debug.getinfo(cmd, "S").short_src, ":t")
- opts['desc'] = "origin@"..file_name
+ opts["desc"] = "origin@"..file_name
end
end
-- define the keybinds
- if type(bind) == 'table' then
+ if type(bind) == "table" then
for i in pairs(bind) do
vim.keymap.set(mode, bind[i], cmd, opts)
end
- elseif type(bind) == 'string' then
+ elseif type(bind) == "string" then
vim.keymap.set(mode, bind, cmd, opts)
end
end
@@ -110,11 +90,11 @@ end
function M.highlight(group, opts, namespace)
namespace = namespace or 0
- if type(group) == 'table' then
+ if type(group) == "table" then
for i in pairs(group) do
vim.api.nvim_set_hl(namespace, group[i], opts)
end
- elseif type(group) == 'string' then
+ elseif type(group) == "string" then
vim.api.nvim_set_hl(namespace, group, opts)
end
end