summaryrefslogtreecommitdiff
path: root/lua/lv-floatterm/init.lua
blob: 0901c1f6e7923aa784d2ec481376155253b793b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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