This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.config/nvim/lua/utils.lua
David JULIEN 8ec80d78f5 feat: use HEAD@neovim instead of arch package
BREAKING: require neovim v0.5+ to work!!!

migrate neovim configuration to lua
2021-05-19 11:56:12 +02:00

35 lines
838 B
Lua

-- Author : swytch
-- Created : Friday Mar 12, 2021 20:07:39 CET
-- License : GPLv3
-- Description : neovim utils file
local M = {} -- The module to export
local cmd = vim.cmd
-- augroup helper
function M.create_augroup(autocmds, name)
cmd("augroup " .. name)
cmd("autocmd!")
for _, autocmd in ipairs(autocmds) do
cmd("autocmd " .. table.concat(autocmd, " "))
end
cmd("augroup END")
end
-- add a path to the rtp
function M.add_rtp(path)
local rtp = vim.o.rtp
rtp = rtp .. "," .. path
end
-- map a key with optional options
function M.map(mode, keys, action, options)
options = options or {}
vim.api.nvim_set_keymap(mode, keys, action, options)
end
-- Make it accessible everywhere
_G.utils = M
-- Export the module
return M