Add remaps for opening terminal

This commit is contained in:
2022-01-16 11:12:26 +03:00
parent b2931e8835
commit 398dec0d74
4 changed files with 47 additions and 4 deletions

View File

@@ -1,11 +1,31 @@
local M = {}
local function map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
local function map(mode, shortcut, command, additional_opts)
local opts = { noremap = true, silent = true }
if opts then
opts = vim.tbl_extend("force", opts, additional_opts)
end
vim.api.nvim_set_keymap(mode, shortcut, command, opts)
end
M.nmap = function(shortcut, command)
map("n", shortcut, command)
M.nmap = function(shortcut, command, opts)
opts = opts or {}
map("n", shortcut, command, opts)
end
M.vmap = function(shortcut, command, opts)
opts = opts or {}
map("v", shortcut, command, opts)
end
M.tmap = function(shortcut, command, opts)
opts = opts or {}
map("t", shortcut, command, opts)
end
M.list_includes_item = function(list, item)