A neovim port of clj-refactor.el
Usage
All commands are mapped under the cr
prefix and use a two letter mnemonic shortcut. E.g. crrs
for Clojure Refactor Rename Symbol
.The full list is below.
Installation
Pre-requisites
Vundle
Using Vundle, add this to your vundle .config/nvim/init.vim section:
Plugin 'snoe/clj-refactor.nvim'
Inside nvim
- run
:PluginInstall
:UpdateRemotePlugins
you should seeremote/host: node host registered plugins ['clj-refactor.nvim']
- close all nvims simultaneously
- refactor
Progress
Options
You can set g:clj_refactor_prune_ns_form
and g:clj_refactor_prefix_rewriting
to 0
to affect the corresponding middleware options. Both default to 1
.
Passive abilities
- Magic requires - experimental
autocmd FileType clojure inoremap <buffer> / /<ESC>:silent! CMagicRequires<CR>a
- Automatic insertion of namespace declaration
Commands
-
crad
add-declaration - add-import
- add-libspec
-
cram
add-missing-libspec - add-project-dependency
- add-stubs
-
crcn
clean-ns -
crfe
create-fn-from-example -
crcc
cycle-coll -
crci
cycle-if -
crcp
cycle-privacy -
crct
cycle-thread - describe-refactor
- destructure-keys
-
crel
expand-let * Doesn't yet replace other usages of bindings -
cred
extract-def -
cref
extract-fn - find-usages
- hotload-dependency
- inline-symbol
-
cril
introduce-let - move-form
-
crml
move-to-let - promote-fn-literal
- promote-fn
- remove-let
- remove-unused-requires
-
crrf
crrd
rename-file-or-dir -
crrs
rename-symbol-global * just rename symbol -
crrs
rename-symbol-local * just rename symbol - replace-use
- show-changelog
- sort-project-dependencies
- stop-referring
-
crtf
thread-first-all -
crtl
thread-last-all -
crtt
thread-last -
crth
thread -
crua
unwind-all -
cruw
unwind-thread
Development / Testing
Run npm install
I generally have 4 terminals open:
$ lein cljsbuild auto test
$ node target/out/tests.js
$ lein cljsbuild auto plugin
$ tail -f "$NVIM_NODE_LOG_FILE"
Somewhere in your environment do
export NVIM_NODE_LOG_FILE="$HOME"/nvimdebug.log
Neovim will dump messages from the plugin there. If something goes wrong it
will likely show up in ~/.nvimlog
To get repl going, use lein repl
and execute below to get into a
clojurescript repl:
(require 'cljs.repl.node)
(cider.piggieback/cljs-repl (cljs.repl.node/repl-env))