Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The magit buffer is editable #152

Closed
sivakov512 opened this issue Nov 17, 2017 · 13 comments
Closed

The magit buffer is editable #152

sivakov512 opened this issue Nov 17, 2017 · 13 comments

Comments

@sivakov512
Copy link

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', type A, i, O` or another command to go into insert-mode

Environment

  • vim or nvim version
    NVIM v.0.2.1

  • git version
    git version 2.15.0

  • current vimagit version or (or SHA1)
    lastest installed with Plug

  • OS
    VoidLinux

  • terminal or gvim
    xfce4-terminal used

@jreybert
Copy link
Owner

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:

  • add a g:magit_editable_buffer option to globally enable/disable this feature
  • when enabled, add a mapping to enter in edit mode
  • add the state of the magit buffer in header info section

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

@sivakov512
Copy link
Author

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

@jreybert
Copy link
Owner

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

@sivakov512
Copy link
Author

sivakov512 commented Nov 17, 2017

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
Copy link
Owner

Thanks for your feedback usage!

@sivakov512
Copy link
Author

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

Can you inform here when this feature will be implemented?

jreybert added a commit that referenced this issue Nov 20, 2017
An example to show to how to use this feature has been added.

ref #152
jreybert added a commit that referenced this issue Nov 20, 2017
An example to show to how to use this feature has been added.

ref #152
@jreybert
Copy link
Owner

@cryptomaniac512 could you please:

Thanks

@sivakov512
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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

@sivakov512
Copy link
Author

Thanks!
Can you show me link to this branch?

jreybert added a commit that referenced this issue Nov 23, 2017
@jreybert jreybert added this to In progress in vimagit dev board Nov 23, 2017
@jreybert
Copy link
Owner

It landed in branch next.

@jreybert jreybert added this to the Release 1.7.3 milestone Oct 12, 2018
vimagit dev board automation moved this from In progress to Done May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants