summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2023-10-30 16:44:57 +0100
committerLinnnus <[email protected]>2023-10-30 19:50:01 +0100
commit556b5dd0e2a742fa19972df3e983d724e80c94cc (patch)
tree8eee2ec61d75ee3d1d21b4e0ab7f301db474b08b
parent13e776e4026f40df8263445340b68fc914e2298e (diff)
home/neovim: Add leining
-rw-r--r--home/dev-utils/default.nix3
-rw-r--r--home/neovim/plugins.nix30
2 files changed, 30 insertions, 3 deletions
diff --git a/home/dev-utils/default.nix b/home/dev-utils/default.nix
index 73c5f29..c2a23c6 100644
--- a/home/dev-utils/default.nix
+++ b/home/dev-utils/default.nix
@@ -23,7 +23,10 @@
]))
tcl-8_6
crystal
+
+ # Clojure ecosystem
clojure
+ leiningen
]
++ lib.optional pkgs.stdenv.isDarwin trash;
diff --git a/home/neovim/plugins.nix b/home/neovim/plugins.nix
index 2610141..a681c9e 100644
--- a/home/neovim/plugins.nix
+++ b/home/neovim/plugins.nix
@@ -29,9 +29,12 @@
plugin = pkgs.vimPlugins.conjure;
type = "lua";
config = ''
- -- Create a command to launch NRepl for Clojure support.
+ local start_clj_repl = "StartCljRepl";
+ local start_lein_repl = "StartLeinRepl";
+
+ -- Create a command to launch nRepl for Clojure support.
-- See: https://github.com/Olical/conjure/wiki/Quick-start:-Clojure
- vim.api.nvim_create_user_command("NRepl", function()
+ vim.api.nvim_create_user_command(start_clj_repl, function()
local id = vim.fn.jobstart({
"${pkgs.clojure}/bin/clj",
"-Sdeps",
@@ -42,9 +45,30 @@
'["cider.nrepl/cider-middleware"]',
"--interactive",
})
+ print("Started nRepl job #" .. id)
end, {
- desc = "Starts an NRepl session in the current directory (for use w/ conjure).",
+ desc = "Starts an nRepl session in the current directory using clj.",
})
+
+ vim.api.nvim_create_user_command(start_lein_repl, function()
+ local id = vim.fn.jobstart({
+ "${pkgs.leiningen}/bin/lein",
+ "repl",
+ })
+ print("Started nRepl job #" .. id)
+ end, {
+ desc = "Starts an nRepl session in the current directory using Lein.",
+ })
+
+ -- Launch nRepl when any clojure file is started.
+ -- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
+ -- pattern = "*.clj",
+ -- command = start_clj_repl,
+ -- });
+
+ -- Jump to bottom of log when new evaluation happens
+ -- See: https://github.com/Olical/conjure/blob/58c46d1f4999679659a5918284b574c266a7ac83/doc/conjure.txt#L872
+ vim.cmd [[autocmd User ConjureEval if expand("%:t") =~ "^conjure-log-" | exec "normal G" | endif]]
'';
}
];