{"id":16911914,"url":"https://github.com/ethagnawl/clojurescript-vim-fireplace-demo","last_synced_at":"2025-04-11T11:31:53.467Z","repository":{"id":42821619,"uuid":"267468021","full_name":"ethagnawl/clojurescript-vim-fireplace-demo","owner":"ethagnawl","description":"A proof of concept which shows how to use Vim-Fireplace to interact with a ClojureScript REPL","archived":false,"fork":false,"pushed_at":"2023-01-07T18:36:41.000Z","size":826,"stargazers_count":4,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T13:39:11.202Z","etag":null,"topics":["clojure","clojurescript","vim-fireplace"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethagnawl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-28T01:51:58.000Z","updated_at":"2021-09-11T22:49:31.000Z","dependencies_parsed_at":"2023-02-07T21:00:53.568Z","dependency_job_id":null,"html_url":"https://github.com/ethagnawl/clojurescript-vim-fireplace-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethagnawl%2Fclojurescript-vim-fireplace-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethagnawl%2Fclojurescript-vim-fireplace-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethagnawl%2Fclojurescript-vim-fireplace-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethagnawl%2Fclojurescript-vim-fireplace-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethagnawl","download_url":"https://codeload.github.com/ethagnawl/clojurescript-vim-fireplace-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384008,"owners_count":21094656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojurescript","vim-fireplace"],"created_at":"2024-10-13T19:08:03.368Z","updated_at":"2025-04-11T11:31:52.920Z","avatar_url":"https://github.com/ethagnawl.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vim-Fireplace ClojureScript Demo\n\n## What?\nThis demo shows developers how to interact with a recent version of\nthe ClojureScript REPL (specifically CLJS \u003e= v1.10.741 and its new `:bundle`\nfeature) via Vim-Fireplace and their _many_ friends.\n\n\n\n## Why?\nWhen I saw the announcement about ClojureScript 1.10.741 and its new NPM\nand JavaScript bundler (e.g. Webpack) integration options, I decided to try to\nresurrect my old Vim/ClojureScript development environment and use it to run\nthrough the examples provided in the new guide.\n\nNeedless to say, _a lot_ has changed in the last ~five years and my old setup\ndid not work with modern versions of ... just about everything.\n\nSo, I decided to undertake an adventure and try and get this environment\nworking, document my findings and share it with others. I sought and received\nhelp from lots of people on Stack Overflow, /r/clojurescript and elsewhere.\nAlso, the various guides and documentation linked below were very useful.\n\nI was also buoyed by the two recent releases of Figwheel (v0.2.5/6) which added\nsupport for these new CLJS features in a very short amount of time. [The\naccompanying guide](https://figwheel.org/docs/npm.html) is also invaluable when coming up to speed with these\nlatest features.\n\n\n## How?\nYou can follow along by [installing Clojure and the CLI tools](https://www.clojure.org/guides/getting_started) and\ncloning this repository.\n\n### Dependencies\nThe required dependencies are defined in deps.edn. I was only able to get this\nworkflow running with the specified versions. Others may work, especially newer\nversions, but I ran into issues with older versions of CLJS (\u003e= 1.10.741 \u0026\u0026 \u003c 1.10.773), nrepl, etc.\n\nThe dependencies will be installed by the Clojure CLI when it is first run or\nthey change.\n\n### REPL Driven Development\n#### Shell\nLaunch a Clojure REPL in your shell using the Clojure CLI tools and Rebel\nReadline (using the alias defined in deps.edn):\n\n`clojure -A:rebel`\n\n#### Clojure REPL\n```\n(require '[fullstack.helpers :refer :all])  ;; import nREPL helpers\n(start-nrepl-server!)                       ;; start nREPL server on 7888\n\n;; Some people run the following commands using Vim-Fireplace's `:CljEval`\n;; command but I found that to be a little clunky.\n;; If I do end up using this workflow regularly, I'll consider packaging these\n;; steps up in a VimScript helper function.\n;; Out of habit, I send them from this document inside vim to a parallel tmux\n;; pane using vim-slime.\n\n(require 'figwheel.main.api)    ;; require Figwheel's scripting API\n(figwheel.main.api/start \"dev\") ;; start Figwheel build (using dev.cljs.edn) and REPL\n```\n\n#### Vim CLI\n```\n:Piggieback (figwheel.main.api/repl-env \"dev\") \" connect to the CLJS REPL\n```\n\n#### Vim-Fireplace\nYou should now have an active connection to the ClojureScript REPL from within\nVim and you can start evaluating forms using [the various Vim-Fireplace\ncommands](https://github.com/tpope/vim-fireplace/blob/master/doc/fireplace.txt#L126-L312).\n\nFor example, try evaluating the following using `cpp` :\n\n`(.log js/console \"Success!\")`\n\nIf the environment is working as expected, you'll see an entry in your\nbrowser's JavaScript console.\n\nFrom there, you can begin interacting with the program running in your browser\nfrom Vim.\n\nFor example, try evaluating the following forms (see src/fullstack/main.cljs):\n\n```\n(in-ns 'fullstack.main)\n(reset! name_ \"CLJS\")\n```\n\n... and switching back to your browser. The application's contents should have\nbeen updated to reflect the evaluated code.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/ethagnawl/clojurescript-vim-fireplace-demo/master/demo.gif\" alt=\"Screenshot\" width=\"80%\" /\u003e\n\u003c/p\u003e\n\n#### TODO: re-export screencap at a higher resolution\n\n## Thanks\n### David Nolen\nDavid's release announcement and the guide for using the new NPM and JavaScript\nbundler were excellent and exciting enough to get me to revisit this\ndevelopment environment. The ClojureScript program found in fullstack.main was\ntaken directly from the guide, which is linked below.\n### Bruce Hauman\nBruce's Figwheel library, documentation and guides were a tremendous help in\ngetting this environment up and running. The contents of fullstack.helpers and\nmost of the \"steps\" required to get the REPL running and connected were taken\ndirectly from the Figwheel/Vim guide linked below.\n\nRebel Readline is also a wonderful library and makes the Clojure/Script REPL\nmore helpful, useful and beautiful.\n### Tim Pope\nThanks to Tim Pope for Vim-Fireplace and every other line in my .vimrc which\nbegins with `Plug 'tpope`.\n\n## Resources\n- https://github.com/tpope/vim-fireplace/\n- https://clojurescript.org/news/2020-04-24-bundle-target\n- https://clojurescript.org/guides/webpack\n- https://github.com/bhauman/figwheel-main/releases/tag/v0.2.6\n- https://figwheel.org/docs/npm.html\n- https://figwheel.org/docs/vim.html\n- https://figwheel.org/docs/scripting_api.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethagnawl%2Fclojurescript-vim-fireplace-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethagnawl%2Fclojurescript-vim-fireplace-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethagnawl%2Fclojurescript-vim-fireplace-demo/lists"}