This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-01
Channels
- # announcements (6)
- # atom-editor (4)
- # babashka (59)
- # beginners (51)
- # bristol-clojurians (6)
- # calva (5)
- # cider (22)
- # clara (6)
- # cljfx (28)
- # clojure (182)
- # clojure-australia (1)
- # clojure-berlin (1)
- # clojure-dev (21)
- # clojure-europe (12)
- # clojure-italy (8)
- # clojure-nl (7)
- # clojure-norway (13)
- # clojure-uk (20)
- # clojurescript (2)
- # code-reviews (24)
- # conjure (9)
- # cursive (9)
- # datomic (35)
- # defnpodcast (45)
- # fulcro (18)
- # graalvm (3)
- # graphql (1)
- # hugsql (1)
- # jobs (3)
- # jobs-discuss (2)
- # klipse (1)
- # leiningen (1)
- # malli (5)
- # membrane (4)
- # off-topic (7)
- # portal (2)
- # reitit (30)
- # remote-jobs (1)
- # rewrite-clj (5)
- # ring (2)
- # shadow-cljs (25)
- # test-check (2)
- # tools-deps (5)
- # vrac (26)
- # xtdb (17)
In the spirit of sharing interesting mappings: I wrote this tonight, an itch I had to try to scratch: https://github.com/Pancia/dotfiles/commit/4886429c6c1e26a78e1feb16b4308a9ee41976bb
function! ResolveSymbol()
call luaeval("require('conjure.client')['with-filetype']('clojure', require('conjure.eval')['eval-str'], { origin = 'dotfiles/clojuredocs', code = '`".expand("<cword>")."', ['on-result'] = function(sym) vim.api.nvim_command('call OpenClojureDocs(\"'..sym..'\")') end})")
endfunction
function! OpenClojureDocs(fqsym)
echomsg "open clojure docs for: " . a:fqsym
let [l:ns, l:sym] = split(a:fqsym, "/")
if l:ns =~? 'clojure\..*'
execute "!open ' ".l:ns."/".l:sym."'"
else
execute "!open '".a:fqsym."'"
endif
endfunction
nnoremap ,vd :call ResolveSymbol()<CR>
,vd mapping to (V)iew (D)ocs for word under cursor in or google
as a note, you'll want to add ['passive?'] = true
to the map with code = ...
or you'll get lots of `symbols in your repl
@olical how do i send a message that some middleware can pick up? eg:
(defn middleware [handler]
(fn [{:keys [op] :as request}]
(if (= op "nrebl-start-ui")
(rebl/ui)
(handler (assoc request :transport (wrap-rebl-sender request))))))
I'm not seeing that in the code... so maybe I should refactor to use eval?
In the conjure.client.clojure.nrepl.server
module there's a send
function that takes a message and a callback. The message being a Lua table.
eval
is built on top of send
so that's probably the function you'll want to hook into. The chances of that changing are near 0 although you may encounter one breaking change when I one day migrate the nREPL code into it's own reusable module, although that may even still not affect you.