summaryrefslogtreecommitdiff
path: root/lua/user/terminal.lua
blob: 8aac7cd0b2a0c3a605dfd4d4bd1ddade5bd7b5ff (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local M={}
M.ipython_toggle = function()
  local Terminal = require("toggleterm.terminal").Terminal
  local ipython = Terminal:new {
    cmd = "ipython",
    hidden = true,
    direction = "horizontal",
    on_open = function(_)
      vim.cmd "startinsert!"
    end,
    on_close = function(_) end,
    count = 98,
    display_name = "ipython",
    label = "ipython",
  }
  ipython:toggle()
end

M.scim_toggle = function()
  local Terminal = require("toggleterm.terminal").Terminal
  local scim = Terminal:new {
    cmd = "sc-im",
    hidden = true,
    direction = "horizontal",
    on_open = function(_)
      vim.cmd "startinsert!"
    end,
    on_close = function(_) end,
    count = 97,
    display_name = "sc-im",
    label = "sc-im",
  }
  scim:toggle()
end

M.w3m_toggle = function()
  local Terminal = require("toggleterm.terminal").Terminal
  local w3m = Terminal:new {
    cmd = "w3m -B",
    hidden = true,
    direction = "horizontal",
    on_open = function(_)
      vim.cmd "startinsert!"
    end,
    on_close = function(_) end,
    count = 96,
    display_name = "w3m",
    label = "w3m",
  }
  w3m:toggle()
end

M.lazygit_toggle = function()
  local Terminal = require("toggleterm.terminal").Terminal
  local lazygit = Terminal:new {
    cmd = "lazygit",
    hidden = true,
    direction = "float",
    float_opts = {
      border = "none",
      width = 100000,
      height = 100000,
      zindex = 200,
    },
    on_open = function(_)
      vim.cmd "startinsert!"
    end,
    on_close = function(_) end,
    count = 99,
  }
  lazygit:toggle()
end

return M