cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
590 stars 7 forks source link

Mapping cursive actions in .ideavimrc #907

Closed JarrodCTaylor closed 9 years ago

JarrodCTaylor commented 9 years ago

Is it possible to map cursive actions in .ideavimrc? If so what would be the best way of discovering the names for the actions?

For example I have the following line in .ideavimrc for finding files

nnoremap <space>ff :action GotoFile<CR>

I would like to make mappings for the slurp and barf actions but have so far been unsuccessful.

JarrodCTaylor commented 9 years ago

The "discovery" solution that I have arrived at is.

1). Set a key mapping for the desired cursive command through the UI 2). Export your settings 3). Inspect the xml that is generated from the export and it will contain the name of the desired actions(s)

cmf commented 9 years ago

This is very useful, thanks - I didn't know that IdeaVim could have actions added like this. I'll investigate, and see if I can configure it to match fireplace and then add that to the doc.

mg4001 commented 9 years ago

I am late to this but it came up on google. You can try :actionlist :cursive. There are others not under the cursive tag but it should be fairly easy to pick them out by browsing :actionlist.

royalaid commented 7 years ago

Hey just came across this issue and spent some time on it, here is a starting point for anyone looking to copy spacemacs style of paredit:

nnoremap <space>kB :action :cursive.actions.paredit/barf-backwards<CR>
nnoremap <space>kb :action :cursive.actions.paredit/barf-forwards<CR>
nnoremap <space>kdx :action :cursive.actions.paredit/kill-sexp<CR>
nnoremap <space>kS :action :cursive.actions.paredit/slurp-backwards<CR>
nnoremap <space>ks :action :cursive.actions.paredit/slurp-forwards<CR>
nnoremap <space>ke :action :cursive.actions.paredit/splice-killing-backwards<CR>
nnoremap <space>kE :action :cursive.actions.paredit/splice-killing-forwards<CR>
nnoremap <space>mrtf :action :cursive.actions.paredit/thread-form<CR>
nnoremap <C-c><C-c> :action :cursive.repl.actions/interrupt <CR>
nnoremap <space>msp :action :cursive.repl.actions/jump-to-output<CR>
nnoremap <space>mss :action :cursive.repl.actions/jump-to-repl<CR>
nnoremap <space>msb :action :cursive.repl.actions/load-file<CR>
nnoremap <space>mem :action :cursive.repl.actions/macroexpansion<CR>
nnoremap <C-<Down>> :action :cursive.repl.actions/next-history-item<CR>
nnoremap <C-<Up>> :action :cursive.repl.actions/prev-history-item<CR>
nnoremap <space>mse :action :cursive.repl.actions/run-last-sexp<CR>
nnoremap <space>msn :action :cursive.repl.actions/run-top-sexp<CR>
nnoremap <space>msx :action :cursive.repl.actions/sync-files<CR>
nnoremap <space>mtx :action :cursive.testing.actions/remove-test-markers<CR>
nnoremap <space>mtr :action :cursive.testing.actions/rerun-last-test <CR>
nnoremap <space>mta :action :cursive.testing.actions/run-ns-tests <CR>
nnoremap <space>mtt :action :cursive.testing.actions/run-single-test<CR>

This doesn't cover everything and without hydra it is a bit harder to navigate but it works. If anything is missing please inform/correct me

cursive-ide commented 7 years ago

@royalaid Thank you! That's great.

Can you explain what you mean about hydra? Is there something I could add here?

royalaid commented 7 years ago

Sure! Fair warning I am very new to Emacs so I am going to be a little out of my depth here but https://github.com/abo-abo/hydra is used to make a second tier leader key in keyboard shortcuts and allows discoverability via a mini-buffer, that is why a lot of my bindings start with k. k in the Spacemacs world enters lisp mode and remaps a bunch of keys i.e h l move a sexp at a time instead of one char. Its more of something that would need to be added to idea-vim or a separate plugin I think but then again it is a very emacs notion to use modes.