switched to lazy.nvim and clean up a bit

This commit is contained in:
iris committed 2023-02-16 01:24:40 -05:00
1 parent 72bf7e727a
commit 11bb713b60
19 files changed
+290 -331

No files matched your search

+9 -9
View File
@@ -3,16 +3,16 @@ local opts = { noremap = true, silent = true }
-- mapping
local mapping = {}
mapping.map = function(mode, from, to) vim.keymap.set(mode, from, to, opts) end
mapping.nmap = function(from, to) vim.keymap.set('n', from, to, opts) end
mapping.nmap = function(from, to) vim.keymap.set("n", from, to, opts) end
mapping.cmd = function(from, content)
vim.keymap.set('n', from, '<cmd>' .. content .. '<cr>', opts)
vim.keymap.set("n", from, "<cmd>" .. content .. "<cr>", opts)
end
-- layout (mapping)
local layout = {}
layout.map = function(from, to)
vim.keymap.set('n', from, to, opts)
vim.keymap.set('x', from, to, opts)
vim.keymap.set("n", from, to, opts)
vim.keymap.set("x", from, to, opts)
end
layout.swap = function(a, b)
layout.map(a, b)
@@ -22,10 +22,10 @@ mapping.layout = layout
-- loading stuff
local load = {}
load.lua_path = vim.fn.stdpath('config') .. '/lua/'
load.lua_path = vim.fn.stdpath("config") .. "/lua/"
load.post_write = function(group, path, fn)
vim.api.nvim_create_autocmd('BufWritePost', {
vim.api.nvim_create_autocmd("BufWritePost", {
group = group,
pattern = load.lua_path .. path,
callback = fn,
@@ -33,12 +33,12 @@ load.post_write = function(group, path, fn)
end
load.mod_post_write = function(group, mod, fn)
local set_name = false
if mod:sub(-1, -1) == '*' then set_name = true end
local path = mod:gsub('[.]', '/') .. '.lua'
if mod:sub(-1, -1) == "*" then set_name = true end
local path = mod:gsub("[.]", "/") .. ".lua"
load.post_write(group, path, function(arg)
local m = mod
if set_name then
local name = arg.file:match('.*/(.*).lua')
local name = arg.file:match(".*/(.*).lua")
m = mod:sub(0, -2) .. name
end
fn(m, arg)