all repos

dotfiles @ 924e562

i use rach linux btw

dotfiles/config/nvim/lua/terminal.lua (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
move nvim config in here, 1 month ago
1
local M = {}
2
3
function M.attach(opts)
4
  opts = opts or {}
5
  local prev_buf = vim.api.nvim_get_current_buf()
6
  vim.cmd.terminal(opts.program)
7
  local term_buf = vim.api.nvim_get_current_buf()
8
  if opts.command ~= nil then
9
    vim.api.nvim_chan_send(vim.bo.channel, opts.command)
10
    vim.api.nvim_chan_send(vim.bo.channel, '\n')
11
  end
12
  if opts.hide == true then
13
    vim.api.nvim_set_current_buf(prev_buf)
14
  end
15
  return term_buf
16
end
17
18
return M