Files
nvim/lua/config/keymaps.lua
Daniel Patterson f98972e43f Add initial config
2023-07-19 12:45:55 +01:00

28 lines
898 B
Lua

-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local Util = require("lazyvim.util")
local function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
-- do not create the keymap if a lazy keys handler exists
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
if opts.remap and not vim.g.vscode then
opts.remap = nil
end
vim.keymap.set(mode, lhs, rhs, opts)
end
end
local lazyterm = function()
Util.float_term(nil, { cwd = Util.get_root() })
end
map("n", "<F7>", lazyterm, { desc = "Terminal (root dir)" })
map("t", "<F7>", "<cmd>close<cr>", { desc = "Hide Terminal" })