This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-16
Channels
- # aleph (1)
- # aws (1)
- # beginners (23)
- # boot (33)
- # cider (15)
- # cljs-dev (4)
- # clojure (73)
- # clojure-dev (18)
- # clojure-italy (8)
- # clojure-russia (7)
- # clojure-serbia (1)
- # clojure-spec (8)
- # clojure-uk (118)
- # clojure-ukraine (3)
- # clojurescript (34)
- # code-art (1)
- # community-development (24)
- # cursive (21)
- # data-science (3)
- # datomic (72)
- # defnpodcast (1)
- # fulcro (77)
- # graphql (4)
- # hoplon (8)
- # jobs (3)
- # luminus (3)
- # lumo (7)
- # off-topic (3)
- # onyx (17)
- # other-languages (7)
- # pedestal (1)
- # perun (1)
- # protorepl (21)
- # re-frame (91)
- # ring (4)
- # ring-swagger (18)
- # shadow-cljs (22)
- # spacemacs (37)
- # specter (1)
- # sql (23)
- # test-check (4)
- # unrepl (29)
- # utah-clojurians (3)
- # vim (36)
- # yada (10)
" Support for Lisp REPL Terminal Interaction
augroup Terminal
au!
au TermOpen * let g:term_jid = b:terminal_job_id
augroup END
" Check if the character under the cursor is the start
" (or end) of something we'd want to send to the REPL.
function! REPLSendSafe()
" Hack to get character under the cursor.
norm "ayl
if index(["(", ")", "[", "]", "{", "}"], @a) >= 0
" Hack to get text using % motion.
norm v%"ay
call REPLSend(@a)
endif
endfunction
function! REPLSend(cmd)
call jobsend(g:term_jid, a:cmd."\n")
endfunction
" If no visual selection, send safely
nnoremap <leader>ef :call REPLSendSafe()<cr>
" If there's a visual selection, just send it
vnoremap <leader>ef "ay:call REPLSend(@a)<cr>
" Send the entire buffer
nnoremap <leader>eb :call REPLSend("(load-file \"".expand('%:p')."\")")<cr>
nnoremap <leader>doc :call REPLSend("(clojure.repl/doc ".expand("<cword>").")")<cr>
FWIW, I quit using the SocketREPL plugin a few days ago and have just been doing this. I like it.
Pretty spartan setup, no gf
, only one REPL connection here, and you have to start it up yourself. But I’ve enjoyed working with it.
I tried that when nvim first came out, but IIRC evaling whole files or large chunks of code would get truncated.
@snoe Yeah I guess it will work ok w/ Clojure using load-file
, but maybe it will have that problem w/ ClojureScript now.
@jebberjeb no jump to source?
I think it was possible because I’d already given up jump to source and other niceties when I left Fireplace. The latest change was brought on by the fact that, as much as I love being able to author plugins in Clojure, and as well as it has worked for me, firing up a JVM process and having a bunch of code just so I can send text over a socket never sat well with me.
So I was looking at tslime.vim the other day when I came across the SO post that shows how jobsend() can be used with Neovim terminal.
Do you find them only niceties? I find them flow conducive. I never have to think to do what I need, I keep moving forward.
The false positives trip me up with tools which are approximate. It breaks my concentration.
Either I’m not frequently working on things that require that degree of concentration, or I’ve found a way, maybe subconsciously, to use those pauses constructively.
I do find the occasional ack-grep does break my flow a bit. In the early stages of working with a codebase, I feel it enough to be frustrated.
They vary quite a bit from project to project. Even with bigger codebases, I usually only interact with a portion of it that is manageable without jump to source.
I think what I’d miss most is a way to jump into jars, for whatever reason i’m doing that almost every day. And @dominicm the approximate problem is why I’m using cursive now, IIRC find-usages didn’t work on keywords and is so much slower through the repl.
@snoe I almost said that. I miss being able to jump into jars. That’s one place I can’t get to easily with ack.
@jebberjeb I don't get the benefit of isolation, I think I'm running all over 50k loc clojure currently. I wouldn't be surprised if it's more now.
@snoe interesting that's a limitation, I can't imagine it's a hard one. Refactor needs a little improving I think.
Most of my work the last couple of years has been ClojureScript heavy. My experience has been that jump to source is a little fickle when working with ClojureScript. At least as far as Fireplace is concerned. But I’ve seen similar complaints from other tools.
Early difficulties using gf
on ClojureScript codebases probably helped me rationalize letting it go, or building the alternative skills.
I still don't really trust fireplace and cljs though, it usually fails. Or launches rhino without my consent.