From 9015332d28cd8f35b5e6bbb9608c286ca69dd1e7 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Sat, 15 Oct 2022 00:34:53 +0000 Subject: [PATCH] Fix gitui custom terminal --- lua/plugins/toggleterm-nvim.lua | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/lua/plugins/toggleterm-nvim.lua b/lua/plugins/toggleterm-nvim.lua index 18f4be3..af60d79 100644 --- a/lua/plugins/toggleterm-nvim.lua +++ b/lua/plugins/toggleterm-nvim.lua @@ -1,16 +1,5 @@ -local cl = vim.o.columns -local ln = vim.o.lines -local width = 0.8 -local height = 0.8 - require("toggleterm").setup({ - direction = "horizontal", - float_opts = { - border = "curved", - width = math.ceil(cl * width), - height = math.ceil(ln * height - 4), - winblend = 3, - }, + direction = "horizontal", open_mapping = [[]], hide_numbers = true, -- shell = 'fish', @@ -33,14 +22,19 @@ vim.keymap.set('t', '', [[wincmd l]]) -- Custom gitui terminal local Terminal = require('toggleterm.terminal').Terminal local gitui = Terminal:new({ - cmd = 'gitui', - direction = 'float', - hidden = true, + cmd = 'gitui', + direction = 'float', + float_opts = { + border = "curved", + width = function() return math.ceil(vim.o.columns * 0.8) end, + height = function() return math.ceil(vim.o.lines * 0.8) end, + winblend = 3, + }, + hidden = true, }) function _gitui_toggle() gitui:toggle() end -vim.api.nvim_set_keymap("n", "G", "lua _gitui_toggle()", { noremap = true, silent = true }) -vim.api.nvim_set_keymap("t", "G", "lua _gitui_toggle()", { noremap = true, silent = true }) +vim.keymap.set('n', 'G', 'lua _gitui_toggle()', { noremap = true, silent = true })