From f6e377fcfed932b71456a0b0780c1f5ed22cabd4 Mon Sep 17 00:00:00 2001 From: Jonathan Raines Date: Tue, 6 Jul 2021 12:40:10 -0500 Subject: Replace LazyGit Plugin with FTerm Instance (#717) * Replace LazyGit Plugin with FTerm Instance * Added gg keybind to FTerm LazyGit * Added check to see if lazygit is installed * Changed lazyload event to prevent error when called from dashboard on startup * Removed lazygit plugin. Changed Fterm lazy loading * Made the executable check more universal for when we include other terminal applications Co-authored-by: rebuilt --- lua/lv-floatterm/init.lua | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lua/lv-floatterm/init.lua (limited to 'lua/lv-floatterm') diff --git a/lua/lv-floatterm/init.lua b/lua/lv-floatterm/init.lua new file mode 100644 index 00000000..0901c1f6 --- /dev/null +++ b/lua/lv-floatterm/init.lua @@ -0,0 +1,39 @@ +local M = {} + +M.config = function() + require'FTerm'.setup({ + dimensions = { + height = 0.8, + width = 0.8, + x = 0.5, + y = 0.5 + }, + border = 'single' -- or 'double' + }) + + -- Create LazyGit Terminal + local term = require("FTerm.terminal") + local lazy = term:new():setup({ + cmd = "lazygit", + dimensions = { + height = 0.9, + width = 0.9 + } + }) + + local function is_installed(exe) + return vim.fn.executable(exe) == 1 + end + + -- Use this to toggle gitui in a floating terminal + function _G.__fterm_lazygit() + if is_installed("lazygit") ~= true then + print("Please install lazygit. Check documentation for more information") + return + end + lazy:toggle() + end +end + +return M + -- cgit v1.2.3 From 0e2ad0c1fec50a24177129c89b3edb9007776caf Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 6 Jul 2021 19:15:37 -0400 Subject: testing autosave config poetnetially unstable --- lua/lv-floatterm/init.lua | 62 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'lua/lv-floatterm') diff --git a/lua/lv-floatterm/init.lua b/lua/lv-floatterm/init.lua index 0901c1f6..5cd6a4ae 100644 --- a/lua/lv-floatterm/init.lua +++ b/lua/lv-floatterm/init.lua @@ -1,39 +1,43 @@ local M = {} M.config = function() - require'FTerm'.setup({ - dimensions = { - height = 0.8, - width = 0.8, - x = 0.5, - y = 0.5 - }, - border = 'single' -- or 'double' - }) + local status_ok, fterm = pcall(require, "FTerm") + if not status_ok then + return + end - -- Create LazyGit Terminal - local term = require("FTerm.terminal") - local lazy = term:new():setup({ - cmd = "lazygit", - dimensions = { - height = 0.9, - width = 0.9 - } - }) + fterm.setup { + dimensions = { + height = 0.8, + width = 0.8, + x = 0.5, + y = 0.5, + }, + border = "single", -- or 'double' + } - local function is_installed(exe) - return vim.fn.executable(exe) == 1 - end + -- Create LazyGit Terminal + local term = require "FTerm.terminal" + local lazy = term:new():setup { + cmd = "lazygit", + dimensions = { + height = 0.9, + width = 0.9, + }, + } + + local function is_installed(exe) + return vim.fn.executable(exe) == 1 + end - -- Use this to toggle gitui in a floating terminal - function _G.__fterm_lazygit() - if is_installed("lazygit") ~= true then - print("Please install lazygit. Check documentation for more information") - return - end - lazy:toggle() + -- Use this to toggle gitui in a floating terminal + function _G.__fterm_lazygit() + if is_installed "lazygit" ~= true then + print "Please install lazygit. Check documentation for more information" + return end + lazy:toggle() + end end return M - -- cgit v1.2.3 From 1ba8539fdd31f6340d5c89312e7673580542769c Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Jul 2021 21:44:51 -0400 Subject: center lazygit --- lua/lv-floatterm/init.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lua/lv-floatterm') diff --git a/lua/lv-floatterm/init.lua b/lua/lv-floatterm/init.lua index 5cd6a4ae..dee11540 100644 --- a/lua/lv-floatterm/init.lua +++ b/lua/lv-floatterm/init.lua @@ -23,6 +23,8 @@ M.config = function() dimensions = { height = 0.9, width = 0.9, + x = 0.5, + y = 0.3, }, } -- cgit v1.2.3