feat(nvim): enable lazyterm keymaps if floaterm or toggleterm are not installed

This commit is contained in:
Sergio Laín 2024-09-03 18:50:05 +02:00
parent 65519e81c5
commit 93fa5539ef
No known key found for this signature in database
GPG key ID: 8429B2EE312F8150
2 changed files with 14 additions and 4 deletions

View file

@ -139,10 +139,6 @@ map("n", "<leader>cir", "<cmd>LazyRoot<cr>", { desc = "Root" })
-- U for redo
map("n", "U", "<C-r>", { desc = "Redo" })
-- Move to beginning/end of line
map("n", "<a-h>", "_", { desc = "First Character of Line" })
map("n", "<a-l>", "$", { desc = "Last Character of Line" })
-- Copy whole text to clipboard
map("n", "<C-c>", ":%y+<CR>", { desc = "Copy Whole Text to Clipboard", silent = true })
@ -192,6 +188,19 @@ end, { desc = "Dashboard" })
map("n", "<leader>!", "zg", { desc = "Add Word to Dictionary" })
map("n", "<leader>@", "zug", { desc = "Remove Word from Dictionary" })
-- Terminal Stuff
if not LazyVim.has("floaterm.nvim") or not LazyVim.has("toggleterm.nvim") then
local lazyterm = function()
LazyVim.terminal(nil, { backdrop = 90.0, size = { width = 0.8, height = 0.8 }, cwd = LazyVim.root() })
end
map("n", "<leader>ft", lazyterm, { desc = "Terminal (Root Dir)" })
map("n", "<leader>fT", function()
LazyVim.terminal(nil, { backdrop = 90.0, size = { width = 0.8, height = 0.8 }, cwd = vim.fn.getcwd() })
end, { desc = "Terminal (cwd)" })
map("n", [[<c-\>]], lazyterm, { desc = "Terminal (Root Dir)" })
map("t", [[<c-\>]], "<cmd>close<cr>", { desc = "Hide Terminal" })
end
-- Marks
map("n", "dm", function()
local cur_line = vim.fn.line(".")

View file

@ -7,6 +7,7 @@ vim.loader.enable()
-- LazyVim related options
vim.g.lazyvim_statuscolumn.folds_open = true
vim.g.lazyvim_statuscolumn.folds_githl = true
vim.g.lazygit_config = false
-- Define leader key
go.mapleader = " "