diff options
author | christianchiarulli <[email protected]> | 2021-07-06 22:20:56 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-07-06 22:20:56 -0400 |
commit | ec9130044266c0d0a2f48b72ba33ccbc8c55d313 (patch) | |
tree | 63ab1a7373a843a10025fbfae88d55d16e8eab4c /lua/lv-floatterm/init.lua | |
parent | f22e1bd8cb6a38fdcad83b96d7739af778cd9d1d (diff) | |
parent | 57f53732491746aedb39f529d6cfab39183f176f (diff) |
Merge branch 'master' of github.com:ChristianChiarulli/LunarVim into stable
Diffstat (limited to 'lua/lv-floatterm/init.lua')
-rw-r--r-- | lua/lv-floatterm/init.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lua/lv-floatterm/init.lua b/lua/lv-floatterm/init.lua new file mode 100644 index 00000000..dee11540 --- /dev/null +++ b/lua/lv-floatterm/init.lua @@ -0,0 +1,45 @@ +local M = {} + +M.config = function() + local status_ok, fterm = pcall(require, "FTerm") + if not status_ok then + return + end + + 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, + x = 0.5, + y = 0.3, + }, + } + + 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 |