jreybert / vimagit

Ease your git workflow within Vim
1.31k stars 49 forks source link

The magit buffer is editable #152

Closed sivakov512 closed 2 years ago

sivakov512 commented 7 years ago

Short description of the problem

The magit buffer is editable. This causes some confusion, since it raises doubts about the reliability of the situation and the work with its changes.

I think that magit buffer should be read-only and be managed only through commands.

Steps to reproduce

Call :Magit', typeA,i,O` or another command to go into insert-mode

Environment

jreybert commented 7 years ago

This is actually a feature. You can modify your hunks, following rules in the documentation, you can stage only part of lines.

However, I get your point. This is an advanced feature, and it is not used much. I can do the following:

This is actually a very good point: restrict this feature will ease future optimization work.

sivakov512 commented 7 years ago

Hm... I can edit staged\unstaged sources inside Magit buffer?

jreybert commented 7 years ago

You can edit unstaged sources. Edit stage source is not restricted, but it won't do anything.

sivakov512 commented 7 years ago

Sounds dangerous =)

add a g:magit_editable_buffer option to globally enable/disable this feature

Yes, I realy need it, thank you =)

Previously, I could not return from the Emacs to Vim\Neovim, because I'm dependent on the Magit and especially the ability to stage hunks, but now thanks to you I have a chance to do it =) (too bad English)

jreybert commented 7 years ago

Thanks for your feedback usage!

sivakov512 commented 7 years ago

add a g:magit_editable_buffer option to globally enable/disable this feature

Can you inform here when this feature will be implemented?

jreybert commented 7 years ago

@cryptomaniac512 could you please:

Thanks

sivakov512 commented 7 years ago

Looks good.

After I finish editing (started with E) how to turn off the modifiable?

How to open file displayed in magit buffer? Previously it was possible with E (But the file was opened not in the place where E was pressed)

jreybert commented 7 years ago

After I finish editing (started with E) how to turn off the modifiable?

You quit edit mode when you refresh the vimagit buffer: it happens when you stage something (with S, F, L) or when you intentionally refresh the buffer with R. Maybe pressing E again when you are in edit mode should leave edit mode.

How to open file displayed in magit buffer? Previously it was possible with E (But the file was opened not in the place where E was pressed)

You are not the first one noticing that. I did not thought this feature was used as much. I was not sure to change this mapping, changing mapping is always a bad idea.. I think before merging this branch to next I will revert the mapping change. So, in the end, E will be the mapping to open the file where there is the hunk, and I need to find a new mapping to enter in edit mode.

For the record, the "jump to the hunk in the file" feature is not accurate, but I think I finally found a solution for this.

sivakov512 commented 7 years ago

I did not thought this feature was used as much

This is a cool feature! It works in Emacs Magit and I use it every hour =)

jreybert commented 7 years ago

I am working on another branch to get a precise jump.

sivakov512 commented 7 years ago

Thanks! Can you show me link to this branch?

jreybert commented 7 years ago

It landed in branch next.