init.lua 854 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. local M = {}
  2. M.config = function()
  3. local status_ok, fterm = pcall(require, "FTerm")
  4. if not status_ok then
  5. return
  6. end
  7. fterm.setup {
  8. dimensions = {
  9. height = 0.8,
  10. width = 0.8,
  11. x = 0.5,
  12. y = 0.5,
  13. },
  14. border = "single", -- or 'double'
  15. }
  16. -- Create LazyGit Terminal
  17. local term = require "FTerm.terminal"
  18. local lazy = term:new():setup {
  19. cmd = "lazygit",
  20. dimensions = {
  21. height = 0.9,
  22. width = 0.9,
  23. x = 0.5,
  24. y = 0.3,
  25. },
  26. }
  27. local function is_installed(exe)
  28. return vim.fn.executable(exe) == 1
  29. end
  30. -- Use this to toggle gitui in a floating terminal
  31. function _G.__fterm_lazygit()
  32. if is_installed "lazygit" ~= true then
  33. print "Please install lazygit. Check documentation for more information"
  34. return
  35. end
  36. lazy:toggle()
  37. end
  38. end
  39. return M