neovim/lua/utils.lua

17 lines
436 B
Lua
Raw Normal View History

2024-03-20 12:49:43 +01:00
local utils = {}
2021-11-25 22:10:31 +01:00
2024-03-20 12:49:43 +01:00
local scopes = { o = vim.o, b = vim.bo, w = vim.wo }
2021-11-25 22:10:31 +01:00
function utils.opt(scope, key, value)
scopes[scope][key] = value
if scope ~= 'o' then scopes['o'][key] = value end
end
function utils.map(mode, lhs, rhs, opts)
2024-03-20 12:49:43 +01:00
local options = { noremap = true, silent = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
2021-11-25 22:10:31 +01:00
end
return utils