Helpers for re-frame.
:ReFrame
command to
-
sub
- Get subscription value:ReFrame sub :i18n/locale
-
event
- Dispatch event:ReFrame event :submit-form
-
fx
- Call effect function:ReFrame fx :reload-page!
-
db
- Read/write app-db value:ReFrame db :foo :items 0 :color :ReFrame db :foo :items 0 :color = "red"
g:re_frame#backend
There is a detection to pick nREPL backend (e.g., vim-iced or vim-fireplace), you can set a fixed value to bypass the detection.
let g:re_frame#backend = 'iced'
The value can be one of iced
, fireplace
.
The :ReFrame
command's auto completion might have candidates too long, you
can set filter and formatter to shorten it.
let g:re_frame#handler_candidates_transform = 're_frame#handlers#candidates_transform'
let g:re_frame#handler_candidates_restore = 're_frame#handlers#candidates_restore'
-
g:re_frame#handler_candidates_transform
This can be set to a Function or String (function name).
The function takes
(items, kind)
arguments.items
are completion candidates,kind
is one of['sub', 'event', 'fx']
.For example
event
sub command will get a list from(re-frame.registrar/get-handler :event)
.You can do filter / map on the List (Vim mutates List in place, so return value is not used here).
-
g:re_frame#handler_candidates_restore
If transform is set, this restore is also needed to ensure the command can find back original id before transform.
This can be set to a Function or String (function name), too.
Takes(id, kind)
arguments.
The two built-in autoload functions:
re_frame#handlers#candidates_transform
re_frame#handlers#candidates_restore
reduce candidates by finding current namespace, for example if you structure your code in small scopes each has its own re-frame db/subs/event along, they leave only handlers belong to nearest scoped ns.
For example, it shortens
:my.company.b2b.some-page.subs/some-field
to
.some-field (when nearest ns is `:my.company.b2b.some-page`)
~some-page.some-field (when nearest ns is `:my.company.b2b`)
-
nREPL backend
Have to communicate with CLJS REPL, currently supports:
- liquidz/vim-iced, see its instruction connecting cljs here.
- tpope/vim-fireplace
Welcome contribution for other backends.
-
Vim version
It is suggested to use newer versions.
Command line completion uses
matchfuzzy()
(introduced Vim 8.2.1665, Neovim PR#12995 await).Without built-in implementation we might use downgrade fallback.