Comments (22)
It's possible somehow I'm sure but there is a conflict with y
so I'd probably want it to be optional. Are you familiar with C-w
I think it is? Is that what you are trying to do?
from evil-magit.
I wasn't familiar with C-w
but that looks like the correct behavior. Having y
optionally map to magit-copy-section-value
would be great.
from evil-magit.
Easy enough. What would you like to do with magit-show-refs-popup
(currently bound to y)?
On Thu, Dec 10, 2015 at 1:52 PM Chris Laverdiere [email protected]
wrote:
I wasn't familiar with C-w but that looks like the correct behavior.
Having y optionally map to magit-copy-section-value would be great.—
Reply to this email directly or view it on GitHub
#11 (comment).
from evil-magit.
I don't use show-refs often, so your call.
from evil-magit.
Set evil-magit-use-y-for-yank
to t
and you will get
yy => magit-copy-section-value
yb => magit-copy-buffer-revision
yr => magit-show-refs
Let me know what you think. I'm happy to make changes
from evil-magit.
Another solution would be to make y
work only in visual mode so magit-show-refs-popup
is still available when nothing is selected.
from evil-magit.
Forget my proposition, I didn't see that it was available under yr
. The OP asked for yanking selection though.
from evil-magit.
@syl20bnr technically there's no visual mode in evil-magit anyway
from evil-magit.
@justbur Do you think this is possible to have a visual state ?
If this is consistent with raw magit in emacs state then I guess it is OK.
TBH I find this a bit disappointing, I often use visual state in evilified magit especially while writing commit message, I go to the diff on the side to copy some stuff.
from evil-magit.
@syl20bnr I keep everything in motion state just to avoid headaches with switching states. You can select with "v", but in evil-magit this uses set-mark-command
instead of changing states. If you want the ability to copy text linewise, I can do that without visual state, and linewise operations are what default magit supports (C-f is not forward-char for example). If you want the ability to copy arbitrary chunks of text, that's a little more involved.
I just didn't think about copying text in magit buffers (I'd just pop open the file if I was going to do that), but it sounds like people do so I'll add the option.
from evil-magit.
@justbur I disagree with this design choice, this is evil-magit
not hybrid-magit
, OTOH magit design prevents forward char so... :-)
Maybe the best is to wait and see if other users request a visual state when they have yy
and yb
.
from evil-magit.
@syl20bnr in magit you have operations that you perform after selecting text if you enter visual state you have to make sure those operations are still available (not shadowed by visual state commands). What does evilification do about this? Doesn't it only affect evilified-state?
from evil-magit.
This is solved in evilified state by emptying the whole keymap of visual state and rebind only y
to evil-yank and ESC
.
Corresponding code is here: https://github.com/syl20bnr/spacemacs/blob/develop/layers/+distribution/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el#L85-L87
from evil-magit.
@justbur but this is a bit trickier actually, the keys passing through the visual state keymap are intercepted by a pre-command-hook to redirect the key to evilified state map. I have a feeling that with your expertise and smart heriarchy of keymaps I could remove this hook.
from evil-magit.
Interesting. Magit changes the behavior of M-w
if the region is active magit/magit#1958
from evil-magit.
Actually... That means that vjjyy
will select and copy text as I currently have it without further changes. It's not exactly vim because there are two "y"s, but it's pretty close. I could make that 1 "y" if people really wanted that...
@claverdiere Sorry for all of the spam. Let me know what you think about the current behavior and we can look into changes.
from evil-magit.
The yy
behavior is good, though just y
to yank from a selection would be nicer, as it's closer to the usual evil behavior. I do like @syl20bnr's suggestion that this mapping would only apply in visual mode, as not to shadow the show-refs binding. If getting visual mode to work with evil-magit is too cumbersome though, I'm happy with what you've implemented.
As for the current set-mark-command behavior, I notice that when using C-w
to copy (I assume the new yy
works the same way), the last line in the selection isn't copied. Is this meant to happen or is it just on my end?
from evil-magit.
Just to be clear, I consider this feature experimental at this point, but I've introduced visual state (linewise only still v does exactly what you'd expect V to do in vim), and the new bindings are
yy => yank line
yr => magit-show-refs-popup
ys => magit-copy-section-value
yb => magit-copy-buffer-revision
In visual state
s => stage
u => unstage
...
y => evil-yank
from evil-magit.
This is fantastic! Works exactly as expected. Thank you!
Unrelated, but I noticed while testing that '/' is mapped to evil-search-forward, but '?' isn't mapped to evil-search-backward. This would be a good remap since 'h' already opens the help menu.
from evil-magit.
I went back and forth on ?
but I think you're right. I'll change it when I get a chance
from evil-magit.
@claverdiere I changed ?
to search backward and then I changed my mind again and put it back to the help popup. My reasoning is that h
is not obvious enough for help to vim users. To compensate I added instructions to the readme to show how to add ?
for search backward.
from evil-magit.
Agreed, thanks for the option.
from evil-magit.
Related Issues (20)
- Can't require evil-magit since Magit switched from magit-popup to Transient HOT 8
- Initialisation warning HOT 1
- Support for GPG signing HOT 3
- In vanilla Magit I can use C-u s to do a "git add -N", can I do this with evil-magit? HOT 9
- void function transient-suffix-put when loading from use- HOT 3
- Magit-log-select very slow on big projects (e.g. Linux kernel) HOT 1
- conflicts with `evil-respect-visual-line-mode' HOT 4
- Keybindings in magit-submodule-list-mode HOT 1
- evil-magit/magit overriding general.el keybindings HOT 6
- Forge: cannot create pull request when using magit forge HOT 1
- Can we bind escape to quit the transient/popup windows HOT 4
- Bury buffer with 'q'? HOT 1
- magit-section don't work with evil visual-state HOT 1
- evil-yank-line doesn't behavior correctly inside doom's magit HOT 3
- evil-magit-add-rebase-messages does not insert commands in buffer when locale is different from english HOT 3
- respect evil-toggle-key HOT 1
- Switching to text-mode and back messes up some keybindings HOT 4
- Void variable error magit-file-mode-map HOT 3
- Evil-magit now part of evil-collection HOT 4
- evil-magit not available on MELPA HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evil-magit.