1
0
Fork 0
dotfiles/home/config/nvim/nifoc/repl.fnl

32 lines
837 B
Text
Raw Normal View History

2022-04-20 14:27:26 +00:00
(let [mod {}
wezterm (require :wezterm)]
(fn exe [bin] (vim.fn.exepath bin))
2022-05-25 20:34:02 +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
(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})
(fn mod.open-shell []
2022-04-20 14:27:26 +00:00
(let [shell (. repl-map :fish)]
(split shell)))
2022-04-20 14:27:26 +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)
(split repl))))
2022-08-25 22:49:54 +00:00
2022-04-20 14:27:26 +00:00
mod)