You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then if I select some lines in visual-line state and do M-x yas-insert-snippet, choosing the snippet above, then the first line of the snippet is highlighted, with the cursor at the beginning of 'environment'. At this point, evil is still in visual-state for a few seconds, and then returns (without any user-interaction) to normal-state, whereupon the cursor-position is moved to the beginning of the line.
The desired behavior would be like it behaves if evil-mode is disabled, and I select a couple of lines and then execute the yas-insert-snippet function. In this case, the final cursor-position remains on the first character of 'environment', and subsequent typing will be mirrored in the \end{} line.
I don't know if this is a bug in Evil or in yasnippet, but I don't know how to determine this. In any case, as it currently is, it seems impossible to use Evil's visual-line state selections with yasnippet.
Note that I am able to get visual-state selections do work if I use:
Original comment byFrank Fischer (Bitbucket: lyro, GitHub: lyro):
Hm, it seems as if Evil's region adjustment does not work well with yasnippet. The problem is that Evil restores the original position of point and mark after the command yas-snippet-insert finishes. This needs some additional work, because currently there is no way to inhibit this behaviour. But if you modify your hook so that it sets the (Emacs) region appropriately after switching to insert state, it should work as expected:
hmm, that workaround doesn't work anymore. Selection isn't cleared when entering yasnippet state. And there is one more issue. The indentation is wrong after inserting the wrapping snippet.
Originally reported by: Mark Edgington (Bitbucket: edgimar, GitHub: edgimar)
When using yasnippet (https://github.com/capitaomorte/yasnippet), if I have a snippet like the following:
then if I select some lines in visual-line state and do M-x yas-insert-snippet, choosing the snippet above, then the first line of the snippet is highlighted, with the cursor at the beginning of 'environment'. At this point, evil is still in visual-state for a few seconds, and then returns (without any user-interaction) to normal-state, whereupon the cursor-position is moved to the beginning of the line.
The desired behavior would be like it behaves if evil-mode is disabled, and I select a couple of lines and then execute the yas-insert-snippet function. In this case, the final cursor-position remains on the first character of 'environment', and subsequent typing will be mirrored in the \end{} line.
I don't know if this is a bug in Evil or in yasnippet, but I don't know how to determine this. In any case, as it currently is, it seems impossible to use Evil's visual-line state selections with yasnippet.
Note that I am able to get visual-state selections do work if I use:
But, if this hook is active, and I try the snippet with visual-line state selections, then the selections are deleted.
The text was updated successfully, but these errors were encountered: