3 ms·
I love reading articles like this about Clojure -- each one demystifies some part of the transition from another, more imperative language. (Here, for me, it wa
by hoprocker 12y ago
I love reading articles like this about Clojure -- each one demystifies some part of the transition from another, more imperative language. (Here, for me, it was how to do unittesting in Clojure coming from Python.)
Something the author touched on is the use of the REPL, in vim, to attach to remote running processes and debug. Does anybody have a quick example of how to do this?
- venantius 12y agoI use Tim Pope's excellent Fireplace.vim - https://github.com/tpope/vim-fireplace https://github.com/tpope/vim-fireplace
- hoprocker 12y agoI installed fireplace.vim when I set up Clojure for the first time (maybe 4, 5 years ago), but didn't really understand much else of Clojure at that point. I'll try it out again, thanks for the tip!
- MBlume 12y agoIn very broad strokes: The start-server command in tools.nrepl https://github.com/clojure/tools.nrepl https://github.com/clojure/tools.nrepl Will open an nREPL (networked REPL) server on some port of your choosing, by default on localhost. Configure your application to allow this to happen on startup. SSH from your dev box to the server, and forward the port the REPL is listening on https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding (having the nREPL port only listen on localhost and then using SSH to access it is somewhat important for security. Someone else who connects to the nREPL port can run arbitrary code with your app's permissions, see any data being processed by your app, etc.) From a shell: lein repl :connect <port> From vim (with tim pope's fireplace plugin): :Connect nrepl://localhost:<port>