Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/severeoverfl0w/vim-replant

A bag of goodies for working with a Clojure REPL
https://github.com/severeoverfl0w/vim-replant

clojure vim

Last synced: 10 days ago
JSON representation

A bag of goodies for working with a Clojure REPL

Awesome Lists containing this project

README

        

= replant.vim: Regrowing again
Dominic Monroe
:experimental:

// I'm trying one sentence per-line here.

[quote,,Online Etymology Dictionary and Oxford Dictionary]
____
replant (v.)
1570s, from re- "back, again" + plant (v.).

Plant (a tree or plant that has been dug up) again, especially when transferring it to a larger pot or new site.
____

This plugin is an attempt to _extend_ the current Clojure/vim ecosystem.
It works with fireplace to add and augment features.
In the future it may replace fireplace, or also use other backends.

link:https://github.com/clojure-emacs[clojure-emacs] have done amazing work to ensure CIDER is usable by other editors.
I wish to have more features in vim, and I'm willing to accept coupling to more nrepl middleware for it.
I'm a Neovim user, so would like to take advantage of new APIs to make developing vim plugins easier or with more features.

[IMPORTANT]
====
Replant is in pre-pre-alpha stages.
I am using it, working full-time on Clojure.
But there may be bugs from time to time, which I will personally solve with a potentially uncommittable solution.
That will leave you with you with a broken plant.
====

== Contributing

All input is welcome!
Feel free to open issues for questions & feature requests.
I am available on link:http://clojurians.net/[Clojurians Slack] in either #vim or as dominicm.

== Install

Currentlyfootnote:[One day I'd like to do this in lua or with a cross-platform Go binary, but not today], this plugin depends on link:https://github.com/neovim/python-client[python-client], so install that first.

.vim-plug
[source,vim]
----
Plug 'SevereOverfl0w/vim-replant', { 'do': ':UpdateRemotePlugins' }
Plug 'tpope/vim-fireplace'
----

Then add the following projects as middleware to your project.

* link:https://github.com/clojure-emacs/cider-nrepl[CIDER-nrepl]
* link:https://github.com/clojure-emacs/refactor-nrepl[refactor-nrepl]

== Features

* [ ] Enhanced Docs
** [ ] Colourful echo'd output on `K`
** [ ] Open document with shortcuts to close, works with `keywordprg`
* [*] Refresh based on cider's built-in refresh
* [ ] Find symbol
** [*] Basic quickfix command
** [ ] Keybinding
** [ ] fzf integration
** [ ] Denite integration
** [ ] Async quickfix
* [*] Hotload dependencies
* [*] Auto-insertion of (ns) for new files.
* [*] List resources (classpath files which aren't source code), and jump to their real location
* [*] Test runner
* [*] Realtime apropos
** [*] for fzf
** [ ] for Denite

=== Refresh

`rf` will perform a tools.namespace refresh, and `ra` will perform a tools.namespace refresh-all.
It searches for your stop/start functions in various namespaces automatically.
If your stop/start functions are unique, you may set `g:replant_refresh_before_hook` and `g:replant_refresh_after_hook` to a symbol referring to your start/stop functions.
Let me know if you have a common stop/start function or namespace which my detection missed.

=== Find symbol

The command `:ReplantFindSymbol` will find references to the symbol under the cursor.
They quickfix window will open automatically after this, if there are any matches found.

=== Dependency hotloading

`:ReplantHotloadDependency aero 1.1.2` will hotload a named dependency into the current JVM.

`:ReplantHotloadDependency` will hotload a dependency in leiningen coordinate style into the current JVM. Intended for use with vim-sexp like `vaf:ReplantHotloadDependency` when on the coordinate.

=== List resources

You can list resources with `:ReplantListResources`.
This will open a quickfix buffer with the real location set, and the relative classpath location as the description.
Resources, as defined by cider-nrepl, are all files on the classpath excluding source files & META-INF.

=== Test Runner

You can run project tests with `:ReplantTestProject`, which takes these arguments:

`+selector`:: Include tests with the metadata "selector" on them.
`-selector`:: Exclude tests with the metadata "selector" on them.
`-load`:: Automatically load project namespaces if they are unloaded (default)
`-no-load`:: Do not automatically load project namespaces

Inclusions & exclusions work exactly as link:https://github.com/cognitect-labs/test-runner[cognitect-labs/test-runner] link:https://github.com/cognitect-labs/test-runner#using-inclusions-and-exclusions[inclusions & exclusions].
They are repeatable a number of times like so: `:ReplantTestProject +integration +unit -member -regression`.

You can conveniently run tests with `rtp` too.

It is also possible to rerun only previously failed tests using `ReplantRetestProject`, which takes no arguments:

Sometimes tests throw an exception, you can use the full power of the tagged stacktrace explorer with tests.
A command will be conveniently provided to you in the form `:ReplantTestStacktrace ns var nr`.
You *must switch to a clojure buffer to run this*.
It will fetch the stacktrace information, and load it into the quickfix window.

== Realtime Apropos (Var Search)

`:ReplantApropos` can be used to load up fzf with all vars.
The standard, kbd:[Ctrl+X], kbd:[Ctrl+V], and kbd:[Ctrl+T] work in the fzf buffer.
In addition, kbd:[Ctrl+I] will bring up a buffer containing doc information about the symbol.

NOTE: Special symbols, recognizable by their lack of namespace, do not have a source to jump to.

WARNING: The doc information is not well tested, and is highly subject to change.

== Developing

I use link:https://squiddev.github.io/urn/[urn] to generate lua files from lisp.
This is fun. Don't doubt me.

.Generate lua files for release
[source]
----
$ make URNPATH=/home/dominic/src/gitlab.com/urn/urn
----