nvim/lua/G.lua

55 lines
895 B
Lua

local G = {}
G.use_ssh = false
G.g = vim.g
G.b = vim.b
G.o = vim.o
G.fn = vim.fn
G.api = vim.api
G.opt = vim.opt
G.loop = vim.loop
G.lb = vim.lsp.buf
G.dic = vim.diagnostic
G.cgp = vim.nvim_create_augroup
function G.map(maps)
for _, map in pairs(maps) do
vim.keymap.set(map[1], map[2], map[3], map[4] or { noremap = true })
end
end
function G.delmap(maps)
for _, map in pairs(maps) do
vim.keymap.del(map[1], map[2], map[3] or {})
end
end
function G.cmd(cmd)
G.api.nvim_command(cmd)
end
function G.exec(c)
G.api.nvim_exec(c)
end
function G.eval(c)
return G.api.nvim_eval(c)
end
function G.au(even, opts)
return G.api.nvim_create_autocmd(even, opts)
end
function G.run_cmd(cmd)
return function()
G.cmd [[set splitbelow | sp]]
G.cmd("term " .. cmd)
G.cmd [[resize 10 | startinsert]]
end
end
G.g.mapleader = ' '
return G