From ba39d9bfe4fe938048fd69688c6b9bf5a1ee236f Mon Sep 17 00:00:00 2001 From: David Ibia Date: Mon, 26 Feb 2024 14:37:06 +0100 Subject: [PATCH] style(toggleterm.lua): fix indentation and alignment for better readability feat(toggleterm.lua): add lazygit terminal setup with custom configurations feat(toggleterm.lua): add keymap to toggle lazygit terminal with leader key feat(toggleterm.lua): comment out keymap for opening a general terminal --- lua/absolute/after/toggleterm.lua | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lua/absolute/after/toggleterm.lua b/lua/absolute/after/toggleterm.lua index 19de47a..2a6cccd 100644 --- a/lua/absolute/after/toggleterm.lua +++ b/lua/absolute/after/toggleterm.lua @@ -2,35 +2,35 @@ local toggle_term = require("toggleterm") local Terminal = require("toggleterm.terminal").Terminal toggle_term.setup({ - direction = "float", + direction = "float", }) local opts = { noremap = true, silent = true } local lazygit = Terminal:new({ - cmd = "lazygit", - dir = "git_dir", - direction = "float", - float_opts = { - border = "double", - }, - -- function to run on opening the terminal - on_open = function(term) - vim.cmd("startinsert!") - vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", opts) - end, - -- function to run on closing the terminal - on_close = function(term) - vim.cmd("startinsert!") - end, + cmd = "lazygit", + dir = "git_dir", + direction = "float", + float_opts = { + border = "double", + }, + -- function to run on opening the terminal + on_open = function(term) + vim.cmd("startinsert!") + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", opts) + end, + -- function to run on closing the terminal + on_close = function(term) + vim.cmd("startinsert!") + end, }) function _LAZYGIT_TOGGLE() - lazygit:toggle() + lazygit:toggle() end opts.desc = "Open lazygit" vim.api.nvim_set_keymap("n", "gs", "lua _LAZYGIT_TOGGLE()", opts) -opts.desc = "Open a terminal" -vim.api.nvim_set_keymap("n", "", "ToggleTerm", opts) +-- opts.desc = "Open a terminal" +-- vim.api.nvim_set_keymap("n", "", "ToggleTerm", opts)