mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 16:51:34 +02:00
Merge commit 'f4858d42a8' as 'config/nvim'
This commit is contained in:
commit
a6d1f45fd6
36 changed files with 906 additions and 0 deletions
27
config/nvim/lua/utils.lua
Normal file
27
config/nvim/lua/utils.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local M = {}
|
||||
|
||||
M.opts = { noremap = true, silent = true }
|
||||
|
||||
function M._map(mode, from, to, opts)
|
||||
vim.api.nvim_set_keymap(mode, from, to, opts)
|
||||
end
|
||||
|
||||
function M.map(mode, from, to)
|
||||
if type(mode) == "table" then
|
||||
for _, m in pairs(mode) do
|
||||
M._map(m, from, to, M.opts)
|
||||
end
|
||||
end
|
||||
|
||||
M._map(mode, from, to, M.opts)
|
||||
end
|
||||
|
||||
function M.nmap(from, to)
|
||||
M._map("n", from, to, M.opts)
|
||||
end
|
||||
|
||||
function M.expr(mode, from, to)
|
||||
M._map(mode, from, to, { noremap = true, expr = true })
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue