2022-04-20 14:27:26 +00:00
|
|
|
(let [mod {}
|
2023-10-15 20:08:36 +00:00
|
|
|
wezterm (require :wezterm)]
|
|
|
|
(fn exe [bin] (vim.fn.exepath bin))
|
2022-05-25 20:34:02 +00:00
|
|
|
|
2023-10-15 20:08:36 +00:00
|
|
|
(fn split [program]
|
|
|
|
(let [args [:cli :split-pane :--bottom :--percent :30 "--"]]
|
|
|
|
(each [_ value (ipairs program)]
|
|
|
|
(table.insert args value))
|
|
|
|
(wezterm.exec args)))
|
2022-05-25 20:34:02 +00:00
|
|
|
|
2023-10-15 20:08:36 +00:00
|
|
|
(local elixir [(exe :iex)])
|
|
|
|
(local erlang [(exe :erl)])
|
|
|
|
(local fennel [(exe :fennel) :--repl])
|
|
|
|
(local fish [(exe :fish)])
|
|
|
|
(local javascript [(exe :node)])
|
|
|
|
(local nix [(exe :nix) :repl])
|
|
|
|
(local ruby [(exe :irb)])
|
2022-04-20 14:27:26 +00:00
|
|
|
;; Map filetype to REPL
|
|
|
|
(local repl-map {: elixir : erlang : fennel : fish : javascript : nix : ruby})
|
|
|
|
|
2023-10-15 20:08:36 +00:00
|
|
|
(fn mod.open-shell []
|
2022-04-20 14:27:26 +00:00
|
|
|
(let [shell (. repl-map :fish)]
|
2023-10-15 20:08:36 +00:00
|
|
|
(split shell)))
|
2022-04-20 14:27:26 +00:00
|
|
|
|
2023-10-15 20:08:36 +00:00
|
|
|
(fn mod.open-repl []
|
2022-04-20 14:27:26 +00:00
|
|
|
(let [ft vim.bo.filetype
|
|
|
|
repl (. repl-map ft)]
|
|
|
|
(when (not= repl nil)
|
2023-10-15 20:08:36 +00:00
|
|
|
(split repl))))
|
2022-08-25 22:49:54 +00:00
|
|
|
|
2022-04-20 14:27:26 +00:00
|
|
|
mod)
|