MarcoIeni / intellimacs

Spacemacs' like key bindings for IntelliJ platform.
MIT License
542 stars 97 forks source link

[Request] Structural editing #50

Open tapegram opened 2 years ago

tapegram commented 2 years ago

Hello! I'm really enjoying this project and depend on it for all my kotlin dev. However, I am increasingly missing the structural editing slurp and barf keys from spacemacs.

I was looking around the intellij plugin ecosystem and it looks like the Cursive is the best bet there -- but structural editing is just a small part of that plugin being for clojure language support, which seems like more than I want. And I'm not sure how to map the keys to my preferred spacemacs bindings.

Is there any chance of this possibly eventually making it into intellimacs, or is that beyond the scope of this project? Thanks!

MarcoIeni commented 2 years ago

Hi tapegram! First of all, thanks for your kind words. I don't use this feature and I don't have time to work on it. If you want you can develop this feature by yourself by adding source path/to/structural_editing.vim to your .ideavimrc.

After that, you can submit a Pull Request and we merge your effort if you want :+1:

JAremko commented 1 week ago

You can call :actionlist to get the list of all Cursive actions available:

Cursive actions ``` :cursive.actions.paredit/backward :cursive.actions.paredit/backward-down :cursive.actions.paredit/backward-up :cursive.actions.paredit/barf-backwards :cursive.actions.paredit/barf-forwards :cursive.actions.paredit/clojure-edit-group :cursive.actions.paredit/clojure-navigate-group :cursive.actions.paredit/close-curly-and-newline :cursive.actions.paredit/close-paren-and-newline :cursive.actions.paredit/close-square-and-newline :cursive.actions.paredit/copy-as-kill :cursive.actions.paredit/cycle-collection-type :cursive.actions.paredit/forward :cursive.actions.paredit/forward-down :cursive.actions.paredit/forward-up :cursive.actions.paredit/join :cursive.actions.paredit/kill :cursive.actions.paredit/kill-sexp :cursive.actions.paredit/move-form-down :cursive.actions.paredit/move-form-up :cursive.actions.paredit/raise :cursive.actions.paredit/slurp-backwards :cursive.actions.paredit/slurp-forwards :cursive.actions.paredit/splice :cursive.actions.paredit/splice-killing-backwards :cursive.actions.paredit/splice-killing-forwards :cursive.actions.paredit/split :cursive.actions.paredit/thread-form :cursive.actions.paredit/toggle :cursive.actions.paredit/unthread-form :cursive.actions.paredit/wrap-curly :cursive.actions.paredit/wrap-paren :cursive.actions.paredit/wrap-quotes :cursive.actions.paredit/wrap-square :cursive.repl.actions/clear-repl :cursive.repl.actions/clojure-repl-commands-group :cursive.repl.actions/clojure-repl-group :cursive.repl.actions/close :cursive.repl.actions/execute :cursive.repl.actions/execute-bookmark :cursive.repl.actions/interrupt :cursive.repl.actions/jump-to-output :cursive.repl.actions/jump-to-repl :cursive.repl.actions/language :cursive.repl.actions/load-file :cursive.repl.actions/macroexpansion :cursive.repl.actions/next-history-item :cursive.repl.actions/prev-history-item :cursive.repl.actions/print-exception :cursive.repl.actions/reconnect :cursive.repl.actions/run-last-sexp :cursive.repl.actions/run-top-sexp :cursive.repl.actions/search-history :cursive.repl.actions/stop :cursive.repl.actions/switch-namespace :cursive.repl.actions/sync-files :cursive.repl.actions/toggle-auto-scroll :cursive.repl.actions/toggle-locals-clearing :cursive.repl.actions/toggle-repl-editor-type :cursive.repl.actions/toggle-soft-wrap :cursive.testing.actions/remove-test-markers :cursive.testing.actions/rerun-last-test :cursive.testing.actions/run-ns-tests :cursive.testing.actions/run-single-test ```

So I fed Spacemacs docs to Claude and asked to extract bindings. Then I combined the list above with the bindings and used intellimacs as example.

And I have this config so far:

hallucination galore ``` " ============================================================================ " WhichKey Descriptions " ============================================================================ " Top-level menus let g:WhichKeyDesc_Major = "m +major-mode" let g:WhichKeyDesc_Structural = "k +structural" " --- Eval and REPL --- let g:WhichKeyDesc_Major_Eval = "me +eval" let g:WhichKeyDesc_Major_Eval_LastSexp = "mee run-last-sexp" let g:WhichKeyDesc_Major_Eval_TopLevel = "mep run-top-sexp" let g:WhichKeyDesc_Major_Eval_Buffer = "meb load-file" let g:WhichKeyDesc_Major_REPL = "ms +repl" let g:WhichKeyDesc_Major_REPL_Clear = "msc clear-repl" let g:WhichKeyDesc_Major_REPL_Quit = "msq close-repl" let g:WhichKeyDesc_Major_REPL_SwitchNS = "msr switch-namespace" let g:WhichKeyDesc_Major_REPL_Switch = "mss jump-to-repl" let g:WhichKeyDesc_Major_REPL_Output = "mso jump-to-output" let g:WhichKeyDesc_Major_REPL_Macroexpand = "msm macroexpansion" let g:WhichKeyDesc_Major_REPL_Execute = "mse execute" let g:WhichKeyDesc_Major_REPL_History = "msh search-history" let g:WhichKeyDesc_Major_REPL_HistoryNext = "msn next-history" let g:WhichKeyDesc_Major_REPL_HistoryPrev = "msp prev-history" let g:WhichKeyDesc_Major_REPL_Stop = "msx stop" let g:WhichKeyDesc_Major_REPL_Interrupt = "msi interrupt" let g:WhichKeyDesc_Major_REPL_Sync = "msy sync-files" let g:WhichKeyDesc_Major_REPL_Exception = "msE print-exception" let g:WhichKeyDesc_Major_REPL_Reconnect = "msR reconnect" " --- Testing --- let g:WhichKeyDesc_Major_Test = "mt +test" let g:WhichKeyDesc_Major_Test_All = "mta run-ns-tests" let g:WhichKeyDesc_Major_Test_Single = "mtt run-single-test" let g:WhichKeyDesc_Major_Test_Rerun = "mtr rerun-last-test" let g:WhichKeyDesc_Major_Test_Clear = "mtc remove-test-markers" " --- Settings --- let g:WhichKeyDesc_Major_Settings = "mR +settings" let g:WhichKeyDesc_Major_Settings_AutoScroll = "mRa toggle-auto-scroll" let g:WhichKeyDesc_Major_Settings_Locals = "mRl toggle-locals" let g:WhichKeyDesc_Major_Settings_Type = "mRt toggle-repl-editor-type" let g:WhichKeyDesc_Major_Settings_Wrap = "mRw toggle-soft-wrap" " --- Structural Editing --- " Navigation let g:WhichKeyDesc_Structural_Forward = "kj next-sexp" let g:WhichKeyDesc_Structural_Backward = "kk prev-sexp" let g:WhichKeyDesc_Structural_ForwardDown = "kl forward-down" let g:WhichKeyDesc_Structural_BackwardUp = "kh backward-up" let g:WhichKeyDesc_Structural_BackwardDown = "kL backward-down" let g:WhichKeyDesc_Structural_ForwardUp = "kH forward-up" let g:WhichKeyDesc_Structural_MoveUp = "kK move-form-up" let g:WhichKeyDesc_Structural_MoveDown = "kJ move-form-down" " Manipulation let g:WhichKeyDesc_Structural_Slurp = "ks slurp-forwards" let g:WhichKeyDesc_Structural_SlurpBack = "kS slurp-backwards" let g:WhichKeyDesc_Structural_Barf = "kb barf-forwards" let g:WhichKeyDesc_Structural_BarfBack = "kB barf-backwards" let g:WhichKeyDesc_Structural_Splice = "kw splice" let g:WhichKeyDesc_Structural_SpliceKillForward = "ke splice-killing-forwards" let g:WhichKeyDesc_Structural_SpliceKillBackward = "kE splice-killing-backwards" let g:WhichKeyDesc_Structural_Join = "kj join" let g:WhichKeyDesc_Structural_Split = "k split" let g:WhichKeyDesc_Structural_Raise = "kr raise" let g:WhichKeyDesc_Structural_CycleCollection = "kc cycle-collection" let g:WhichKeyDesc_Structural_Kill = "kd kill" let g:WhichKeyDesc_Structural_KillSexp = "kD kill-sexp" let g:WhichKeyDesc_Structural_CopyKill = "ky copy-as-kill" let g:WhichKeyDesc_Structural_Toggle = "kt toggle" " Threading let g:WhichKeyDesc_Structural_Thread = "k> thread-form" let g:WhichKeyDesc_Structural_Unthread = "k< unthread-form" " Wrapping let g:WhichKeyDesc_Structural_WrapRound = "k( wrap-paren" let g:WhichKeyDesc_Structural_WrapSquare = "k[ wrap-square" let g:WhichKeyDesc_Structural_WrapCurly = "k{ wrap-curly" let g:WhichKeyDesc_Structural_WrapQuote = "k\" wrap-quotes" let g:WhichKeyDesc_Structural_CloseParenNewline = "k) close-paren-newline" let g:WhichKeyDesc_Structural_CloseSquareNewline = "k] close-square-newline" let g:WhichKeyDesc_Structural_CloseCurlyNewline = "k} close-curly-newline" " ============================================================================ " Mappings " ============================================================================ " --- Structural Editing --- " Navigation nnoremap kj :action :cursive.actions.paredit/forward vnoremap kj :action :cursive.actions.paredit/forward nnoremap kk :action :cursive.actions.paredit/backward vnoremap kk :action :cursive.actions.paredit/backward nnoremap kl :action :cursive.actions.paredit/forward-down vnoremap kl :action :cursive.actions.paredit/forward-down nnoremap kh :action :cursive.actions.paredit/backward-up vnoremap kh :action :cursive.actions.paredit/backward-up nnoremap kL :action :cursive.actions.paredit/backward-down vnoremap kL :action :cursive.actions.paredit/backward-down nnoremap kH :action :cursive.actions.paredit/forward-up vnoremap kH :action :cursive.actions.paredit/forward-up nnoremap kK :action :cursive.actions.paredit/move-form-up vnoremap kK :action :cursive.actions.paredit/move-form-up nnoremap kJ :action :cursive.actions.paredit/move-form-down vnoremap kJ :action :cursive.actions.paredit/move-form-down " Slurp & Barf nnoremap ks :action :cursive.actions.paredit/slurp-forwards vnoremap ks :action :cursive.actions.paredit/slurp-forwards nnoremap kS :action :cursive.actions.paredit/slurp-backwards vnoremap kS :action :cursive.actions.paredit/slurp-backwards nnoremap kb :action :cursive.actions.paredit/barf-forwards vnoremap kb :action :cursive.actions.paredit/barf-forwards nnoremap kB :action :cursive.actions.paredit/barf-backwards vnoremap kB :action :cursive.actions.paredit/barf-backwards " Splice operations nnoremap kw :action :cursive.actions.paredit/splice vnoremap kw :action :cursive.actions.paredit/splice nnoremap ke :action :cursive.actions.paredit/splice-killing-forwards vnoremap ke :action :cursive.actions.paredit/splice-killing-forwards nnoremap kE :action :cursive.actions.paredit/splice-killing-backwards vnoremap kE :action :cursive.actions.paredit/splice-killing-backwards " Kill operations nnoremap kd :action :cursive.actions.paredit/kill vnoremap kd :action :cursive.actions.paredit/kill nnoremap kD :action :cursive.actions.paredit/kill-sexp vnoremap kD :action :cursive.actions.paredit/kill-sexp nnoremap ky :action :cursive.actions.paredit/copy-as-kill vnoremap ky :action :cursive.actions.paredit/copy-as-kill " Split & Join nnoremap k :action :cursive.actions.paredit/split vnoremap k :action :cursive.actions.paredit/split nnoremap kj :action :cursive.actions.paredit/join vnoremap kj :action :cursive.actions.paredit/join " Collection operations nnoremap kc :action :cursive.actions.paredit/cycle-collection-type vnoremap kc :action :cursive.actions.paredit/cycle-collection-type " Threading nnoremap k> :action :cursive.actions.paredit/thread-form vnoremap k> :action :cursive.actions.paredit/thread-form nnoremap k< :action :cursive.actions.paredit/unthread-form vnoremap k< :action :cursive.actions.paredit/unthread-form " Wrapping nnoremap k( :action :cursive.actions.paredit/wrap-paren vnoremap k( :action :cursive.actions.paredit/wrap-paren nnoremap k[ :action :cursive.actions.paredit/wrap-square vnoremap k[ :action :cursive.actions.paredit/wrap-square nnoremap k{ :action :cursive.actions.paredit/wrap-curly vnoremap k{ :action :cursive.actions.paredit/wrap-curly nnoremap k" :action :cursive.actions.paredit/wrap-quotes vnoremap k" :action :cursive.actions.paredit/wrap-quotes " Close and newline nnoremap k) :action :cursive.actions.paredit/close-paren-and-newline vnoremap k) :action :cursive.actions.paredit/close-paren-and-newline nnoremap k] :action :cursive.actions.paredit/close-square-and-newline vnoremap k] :action :cursive.actions.paredit/close-square-and-newline nnoremap k} :action :cursive.actions.paredit/close-curly-and-newline vnoremap k} :action :cursive.actions.paredit/close-curly-and-newline " Toggle paredit nnoremap kt :action :cursive.actions.paredit/toggle vnoremap kt :action :cursive.actions.paredit/toggle " --- REPL Mappings --- nnoremap mee :action :cursive.repl.actions/run-last-sexp vnoremap mee :action :cursive.repl.actions/run-last-sexp nnoremap mep :action :cursive.repl.actions/run-top-sexp vnoremap mep :action :cursive.repl.actions/run-top-sexp nnoremap meb :action :cursive.repl.actions/load-file vnoremap meb :action :cursive.repl.actions/load-file nnoremap msc :action :cursive.repl.actions/clear-repl vnoremap msc :action :cursive.repl.actions/clear-repl nnoremap msq :action :cursive.repl.actions/close vnoremap msq :action :cursive.repl.actions/close nnoremap msr :action :cursive.repl.actions/switch-namespace vnoremap msr :action :cursive.repl.actions/switch-namespace nnoremap mss :action :cursive.repl.actions/jump-to-repl vnoremap mss :action :cursive.repl.actions/jump-to-repl nnoremap mso :action :cursive.repl.actions/jump-to-output vnoremap mso :action :cursive.repl.actions/jump-to-output nnoremap msm :action :cursive.repl.actions/macroexpansion vnoremap msm :action :cursive.repl.actions/macroexpansion nnoremap mse :action :cursive.repl.actions/execute vnoremap mse :action :cursive.repl.actions/execute nnoremap msh :action :cursive.repl.actions/search-history vnoremap msh :action :cursive.repl.actions/search-history nnoremap msn :action :cursive.repl.actions/next-history-item vnoremap msn :action :cursive.repl.actions/next-history-item nnoremap msp :action :cursive.repl.actions/prev-history-item vnoremap msp :action :cursive.repl.actions/prev-history-item nnoremap msx :action :cursive.repl.actions/stop vnoremap msx :action :cursive.repl.actions/stop nnoremap msi :action :cursive.repl.actions/interrupt vnoremap msi :action :cursive.repl.actions/interrupt nnoremap msy :action :cursive.repl.actions/sync-files vnoremap msy :action :cursive.repl.actions/sync-files nnoremap msE :action :cursive.repl.actions/print-exception vnoremap msE :action :cursive.repl.actions/print-exception nnoremap msR :action :cursive.repl.actions/reconnect vnoremap msR :action :cursive.repl.actions/reconnect " Settings mappings nnoremap mRa :action :cursive.repl.actions/toggle-auto-scroll vnoremap mRa :action :cursive.repl.actions/toggle-auto-scroll nnoremap mRl :action :cursive.repl.actions/toggle-locals-clearing vnoremap mRl :action :cursive.repl.actions/toggle-locals-clearing nnoremap mRt :action :cursive.repl.actions/toggle-repl-editor-type vnoremap mRt :action :cursive.repl.actions/toggle-repl-editor-type nnoremap mRw :action :cursive.repl.actions/toggle-soft-wrap vnoremap mRw :action :cursive.repl.actions/toggle-soft-wrap " Testing mappings nnoremap mta :action :cursive.testing.actions/run-ns-tests vnoremap mta :action :cursive.testing.actions/run-ns-tests nnoremap mtt :action :cursive.testing.actions/run-single-test vnoremap mtt :action :cursive.testing.actions/run-single-test nnoremap mtr :action :cursive.testing.actions/rerun-last-test vnoremap mtr :action :cursive.testing.actions/rerun-last-test nnoremap mtc :action :cursive.testing.actions/remove-test-markers vnoremap mtc :action :cursive.testing.actions/remove-test-markers " Raise operation nnoremap kr :action :cursive.actions.paredit/raise vnoremap kr :action :cursive.actions.paredit/raise " Toggle nnoremap kt :action :cursive.actions.paredit/toggle vnoremap kt :action :cursive.actions.paredit/toggle ```