nvim: Layz-load REPL and shell exes
This commit is contained in:
parent
3a430aaf62
commit
f034a84bf8
1 changed files with 23 additions and 12 deletions
|
@ -2,30 +2,41 @@
|
||||||
wezterm (require :wezterm)]
|
wezterm (require :wezterm)]
|
||||||
(fn exe [bin] (vim.fn.exepath bin))
|
(fn exe [bin] (vim.fn.exepath bin))
|
||||||
|
|
||||||
(fn split [program]
|
(fn open-split [program-fn]
|
||||||
(let [args [:cli :split-pane :--bottom :--percent :30 "--"]]
|
(let [args [:cli :split-pane :--bottom :--percent :30 "--"]
|
||||||
|
program (program-fn)]
|
||||||
(each [_ value (ipairs program)]
|
(each [_ value (ipairs program)]
|
||||||
(table.insert args value))
|
(table.insert args value))
|
||||||
(wezterm.exec args)))
|
(wezterm.exec args)))
|
||||||
|
|
||||||
(local elixir [(exe :iex)])
|
(local elixir #[(exe :iex)])
|
||||||
(local erlang [(exe :erl)])
|
(local erlang #[(exe :erl)])
|
||||||
(local fennel [(exe :fennel) :--repl])
|
(local fennel #[(exe :fennel) :--repl])
|
||||||
(local fish [(exe :fish)])
|
(local fish #[(exe :fish)])
|
||||||
(local javascript [(exe :node)])
|
(local java #[(exe :jshell)])
|
||||||
(local nix [(exe :nix) :repl])
|
(local javascript #[(exe :node)])
|
||||||
(local ruby [(exe :irb)])
|
(local nix #[(exe :nix) :repl])
|
||||||
|
(local ruby #[(exe :irb)])
|
||||||
|
(local typescript #[(exe :node)])
|
||||||
;; Map filetype to REPL
|
;; Map filetype to REPL
|
||||||
(local repl-map {: elixir : erlang : fennel : fish : javascript : nix : ruby})
|
(local repl-map {: elixir
|
||||||
|
: erlang
|
||||||
|
: fennel
|
||||||
|
: fish
|
||||||
|
: java
|
||||||
|
: javascript
|
||||||
|
: nix
|
||||||
|
: ruby
|
||||||
|
: typescript})
|
||||||
|
|
||||||
(fn mod.open-shell []
|
(fn mod.open-shell []
|
||||||
(let [shell (. repl-map :fish)]
|
(let [shell (. repl-map :fish)]
|
||||||
(split shell)))
|
(open-split shell)))
|
||||||
|
|
||||||
(fn mod.open-repl []
|
(fn mod.open-repl []
|
||||||
(let [ft vim.bo.filetype
|
(let [ft vim.bo.filetype
|
||||||
repl (. repl-map ft)]
|
repl (. repl-map ft)]
|
||||||
(when (not= repl nil)
|
(when (not= repl nil)
|
||||||
(split repl))))
|
(open-split repl))))
|
||||||
|
|
||||||
mod)
|
mod)
|
||||||
|
|
Loading…
Reference in a new issue