Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

evil-visual-char Request #26

Open
jojojames opened this issue Nov 23, 2016 · 6 comments
Open

evil-visual-char Request #26

jojojames opened this issue Nov 23, 2016 · 6 comments

Comments

@jojojames
Copy link

When using (setq evil-magit-want-horizontal-movement t), sometimes (most of the time), I'd like to be able to select the text I want to yank with v, but both v and V go to evil-visual-line.

If there are no downfalls, could we get a setting to get the old 'v' functionality?

Thanks!

@justbur
Copy link
Member

justbur commented Nov 25, 2016

This has been discussed and is a little more complicated than it first seems. I can give more details, but the main problem is that magit is basically line based, and you typically can't take actions on parts of lines.

With line selection, V, you can still take magit actions seamlessly. For a simple example, Vjjl brings up the magit log popup, meaning you do not move the cursor forward with l in "visual state". Of course, it's not really visual state anymore because of this. Presumably vjjl would behave differently under your proposal and this is confusing I think.

One way to do what you want already which is not "evil-like" is to enter into what I called text-mode with C-t. You can do this in any magit buffer using evil-magit. After C-t everything is just text and you can copy and move around as you like.

I can look into other options, but again this will almost surely involve introducing inconsistencies.

@jojojames
Copy link
Author

Thanks for the explanation.

I don't normally enter visual state when using magit commands (not familiar with the commands that operate on multiple lines in magit), so for me, entering visual state almost always means I'm trying to work with the text itself.

I'll try out C-t and see how it works for me.

@justbur
Copy link
Member

justbur commented Nov 29, 2016

One thing I was thinking about would be to have v not shadow the selection/movement and other evil commands, and reserve V for selecting and operating on lines using magit commands. This still seems a little awkward but it makes sense to me.

By the way, the commands the operate on lines in magit can be useful. For example, you can stage a subset of lines from a hunk.

@jojojames
Copy link
Author

That's be an interesting option to try. I think there's a lot of value from being able to copy certain text while inside magit so even if it's a little awkward, it'd probably be worth adjusting to.

Right now I just copy the entire text, paste it in a scratch buffer and then copy the values out of that.

You're right about the stage commits. That's what I use it for too.

@justbur
Copy link
Member

justbur commented Nov 30, 2016

It's going to be tricky to do this, because visual-line and visual-char both share the same underlying keymaps by default. Getting one set of bindings after visual-char and another after visual-line would I think involve some somewhat complicated trickery.

Try the text mode thing with C-t. Conceptually I think it works well, because after C-t all of the typical evil bindings become active across all of the states. You can move around the same way in normal and visual states with f for example.

@jojojames
Copy link
Author

Thanks, I'll give that a shot then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants