Open jrheard opened 8 years ago
So this is a bit awkward, right. Unfortunately Cursive cannot (as far as I know) interact with IdeaVim, so IdeaVim has no concept of sexps. I know IdeaVim is customisable to a certain extent but I haven't had time to investigate this much. However I'm planning to try to fix this soon and will update this issue if I manage to do so. Thanks for the repro cases, they''ll be useful in trying to figure out how to fix this. If you notice any more, feel free to add them here and I'll check them too.
thanks so much for the response! i would absolutely 100% love a fix for this - best of luck + thanks!
BTW I've added an IdeaVim issues wiki page to collect information relating to IdeaVim.
nice, that'll be super helpful.
here's another issue i hadn't noticed -
(defn foo [bar]
(+ bar 3))
if i move the caret over the second line and press yy (for "yank"), then move to a different line and press p for paste, i get
(+ bar 3))
which is unbalanced. in vim, i'd have gotten
(+ bar 3)
so same idea as the deletion issue, but for insertions.
Here's a simple one:
()
Delete either one of the parens with x
in IdeaVIM and the other one is left unbalanced.
Isn't IdeaVIM using the standard IntelliJ editing actions under the hood, shouldn't whatever hooks Cursive is using to do the post-edit paredit rebalancing fire just the same?
Updated: In parinfer mode the rebalancing is done as expected (although different from paredit) after using any IdeaVIM command.
Is it possible to override IdeaVim commands with s-exp aware analogs?
Is is possible to turn off post rebalancing for ()
?
@kirillsalykin It's been a while :). However, this may be useful to future people. I set in my .ideavimrc several overrides, but these may be useful to you:
nnoremap J :action :cursive.actions.paredit/forward<CR>
nnoremap K :action :cursive.actions.paredit/backward<CR>
nnoremap H :action :cursive.actions.paredit/barf-forwards<CR>
nnoremap L :action :cursive.actions.paredit/slurp-forwards<CR>
nnoremap w :action EditorSelectWord<CR>
vnoremap w :action EditorSelectWord<CR>
onoremap w :action EditorSelectWord<CR>
nnoremap W :action EditorUnSelectWord<CR>
vnoremap W :action EditorUnSelectWord<CR>
onoremap W :action EditorUnSelectWord<CR>
nnoremap m :action :cursive.actions.paredit/move-form-down<CR>
nnoremap M :action :cursive.actions.paredit/move-form-up<CR>
nnoremap z :action :cursive.repl.actions/run-top-sexp<CR>
vnoremap z :action :cursive.repl.actions/run-top-sexp<CR>
hi! sorry if this is a known issue, i've been having a really hard time turning anything up in google searches.
with cursive and ideavim installed, if i'm editing the following code:
(defn thing [bar]
(+ bar 3))
if i move the caret over the second line and press dd, i'm left with
(defn thing [bar]
whereas in vim, with paredit enabled, i'd be left with
(defn thing [bar] )
so the point here is that ideavim doesn't respect structural editing's whole thing of making sure you've always got the right amount of open/close parentheses. you can also observe this with the
x
command in vim - you can easily delete parentheses and structural editing doesn't stop you.this isn't a huge deal in this toy example, but can be a huge pain if i'm eg deleting the last line of a big function so i can move it elsewhere - i end up taking out ten closing parentheses by accident, and then i have to disable structural editing and write some close parentheses by hand and eyeball my rainbow parens to make sure everything's balanced and then reenable structural editing, and by this point i've forgotten what i was actually trying to do to my code in the first place.
is this the sort of thing that's possible to fix? i'm completely loving everything about cursive so far, i've really been blown away, but this is definitely the one specific biggest issue that's making it hard to decide whether or not to buy a license.
thanks so much for your great work on this excellent tool!