vimagit : Ease your git workflow within vim.
| script karma
Downloaded by 3561
Comments, bugs, improvements
script versions (upload new version)
|See complete description and source on github: https://github.com/jreybert/vimagit
Join the chat at https://gitter.im/jreybert/vimagit
Ease your git workflow within vim.
From a very single vim buffer, you can perform main git operations in few key press. To name a few:
* Visualize all diffs in your git repository.
* Stage file, hunks or even just parts of a hunk using a single key press.
* Write or amend your commit message and commit in the same buffer.
Take a look at TL;DR to start using it immediately.
This workflow is 100% inspired from magnificent emacs Magit plugin.
## Outstanding features
* [x] Preview all your git changes in one unique buffer, folded at hunk level.
* [x] Interactively stage/unstage/discard changes with one key press.
* [x] Stage/unstage at file/hunk/line level.
* [x] Write the commit message in the same buffer.
* [x] From a hunk in magit buffer, jump to the file at the diff position.
* [x] 100% VimL plugin, no external dependency (except git of course).
* [x] Enhanced by external plugins: vim-gitgutter vim-airline
* [x] Stable. All features are tested in continuous integration.
More to come:
* [ ] Add a push function, taking care if needed about the remote repository and branch #24 .
* [ ] Handle commit fixup! and squash!, with a smart git log popup #23 .
* [ ] Handle stash: add, pop, apply, drop #26 .
* [ ] Stage multiple hunks or file by visually selecting them #83 .
* [ ] Go through history, cherry-pick changes.
* [ ] Make vimagit more efficient for huge repositories, with a lot of diffs.
* [ ] Something is missing? Open an issue!
> Why should I use vimagit, there are already plethora git plugins for vim?
* fugitive is a very complete plugin, with a lot of functions. I use it for years, and it is a fundamental tool in my workflow. But visualize your changes and staged them in broad number of files is really a pain.
* vim-gitgutter is very well integrated into vim, but without the ability to commit stages, it stays an informational plugin.
This is the minimal required set of command you must know to start playing with vimagit. See [Mappings](#mappings) for a complete description.
To simply test vimagit, modify/add/delete/rename some files in a git repository and open vim.
Open magit buffer with :Magit command.
Jump to next hunk with `<C-n>`, or move the cursor as you like. The cursor is on a hunk.
While the cursor is on an unstaged hunk, press `S` in Normal mode: the hunk is now staged, and appears in "Staged changes" section (you can also unstage a hunk from "Staged section" with `S`).
Once you have stage all the required changes, press `CC`.
- Section "Commit message" is shown.
- Type your commit message in this section.
- To commit, go back in Normal mode, and press `CC` (or `:w` if you prefer).
You just created your first commit with vimagit!
|The plugin hierarchy tree respects the vim plugin standard. It is compatible with pathogen (and most probably vundle).
git clone https://github.com/jreybert/vimagit
Click on the package to download.
ip used for rating: 188.8.131.52
This release adds some minor improvements, and fixes a lot of bugs. Most of
these has been in master branch since a long time.
* Add option to auto-close magit buffer/window on clean state #132
* Jump to source is now line precise #152 #153
Using the 'E' (for edit) mapping, cursor will now jump to the exact line
instead of the beginning of the hunk.
* Smarter cursor position when staging/refreshing.
When refreshing, the cirsor stays in the same position. When (un)staging,
cursor move to the hunk close to the current one.
* Add vimagit support to vim-airline
* Fix freeze while refresh fix #170 #36
* Fix character escape issues #156 #168
These are two old issues, which have been reproduced thanks to the issue
#168. Big up to @akrejczinger for the docker image.
* Discarding untracked file results in an error in some cases fix #165
* Ungraceful behaviour when opening magit outside of a git repo fix #162
* Freshly created repository fails to open in vimagit fix #169
* Handle commit set at the end of magit_default_sections #149
||This is a *not so minor* vimagit update at the end.
It adds a nice feature, setting the cursor position on magit buffer opening at a smart position: if you are editing a file, and your cursor is in the middle of a modification, magit will open with he cursor on this hunk.
User will also notice that standard mappings (`L` or `E` to cite a few) are no longer broken in commit mode. This may a be a first step to introduce default mappings without `Shift` (see #101)
It also fixes some minor bugs (meaning these bugs were not break anything).
I also want to advertise that the next major release of vimagit will see 3 new important features. Interested users are encouraged to discuss the best way to design these new features on https://gitter.im/jreybert/vimagit and on opened issues:
* git push: push from magit buffer with `<CP>`. magit will detect the default push branch; if there is not default, or if the user used another mapping, magit will provide a way to select remote branch to push #24
* git checkout: checkout a branch with `<CH>`. Like for push, a UI must be designed to select the branch, with completion of course #141
* git stash: stage what you want (files, hunks, lines, exactly the same way as for a commit), and stash them #142
* Open magit buffer with a smart cursor position. When opening magit buffer, cursor is set to current file file hunk, if any #125
* Disable most of the mappings in commit mode (i.e. when user is editing). For example, user can now use 'L' or 'E' when editing its commit message #101 #106
* Magit now shows more information on top: it shows the current remote upstream branch and remote push branch. This is a first step to the git push feature!
* Add VimagitLeaveCommit User autocmd. WithVimagitEnterCommit and VimagitLeaveCommit, you can now set the textwidth when you are editing your commit message (see VimagitLeaveCommit section in vimagit help) #140
* You can now use Enter to fold/unfold a file #71
* Fix 'quit' behavior to something consistent: if opened with Magit (i.e. splitting the window) 'q' close the magit buffer; if opened with MagitOnly (i.e. using the current buffer), 'q' switch to the previous buffer. If magit is the last opened window, and it does not have an alternate buffer, it quits vim #137
* Fix jump to "file already open" abort #128
* Fix warning when magit is closed with bdelete #130
* Fix .gitmessage template commit duplicate on refresh #135
Users who have contributed to this release:
||Some bugs have been reported right after the release 1.7.0
* when info section is last section, commit title like "vim: " can be intertpreted as a modeline #120
* vimagit opens in location list #119
With the new cursor behavior, commit a serie of hunk has never been so delightful! Stage one hunk and have a natural look to the next hunk in one move.
Also, think to enable vimagit support in vim-airline with `let g:airline#extensions#vimagit#enabled = 1`
* Smart cursor position when staging #96 #115
* Check user's commit message length #86 #116
* New mappings `<C-n>` `<C-p>` to jump to hunks #101
* Jump through closed files too #99
* Enlarge or shrink hunks #97
* Commit message with standard write commands :w :x :wq ZZ #91
* Add support for Vim-Signify #93
* Change inline help toggling mapping from 'h' to '?' #80
* Add magit#show_version() and g:magit_version #69
* Remove ugly 'End commit message' from vimagit buffer #84
* Add `<nowait>` to buffer mappings #85
* Fix inline help bug with commit section #110
* Handle empty commit (without staged file) and empty commit message #79
* Escape vimagit path to solve space issue #89
* Support commit.verbose=yes #98
* Escape dirs while chdir #89
* Avoid breaking tab-local directory settings #95
* Handle old vim ~ 7.4-0 fnameescape behavior on Windows #108
* Fix E871 error when staging #117
* Show custom mapping in inline help #103
Thanks to @hkupty @scps950707 @Alok @aschrab @thirtythreeforty @olshevskiy87 @poohzrn
New feature *jump* is really awesome, you must try it!
* From a hunk in the magit buffer, press *E* and *jump* the corresponding file
at the diff position. If this file is already opened in a window, cursor move
to this window.
* Add events at key points in magit buffer. User can plug commands to these
events. This new feature brings the two next features:
* If vim-gitgutter is installed, auto update its signs when git status is
* You can find in help a tip to enter in commit mode in insert mode.
* User can set its own git exec binary with g:magit_git_cmd variable.
* Commit message is preserved when the magit buffer is refreshed (fix #57)
* It is now possible to unstage by selection (fix #32)
* When opening a magit session, if a magit buffer for this git repository is
already open, jump to this buffer.
* Inline help shows mapped key instead of default (fix #72)
* Fix peculiar folding behavior when magit buffer is refreshing.
Almost a major release, with some cool new feature. But the release 1.6 will be reaaally cool!
* add command CU (commit undo) to close commit section (fix #55)
* add g:magit_discard_untracked_do_delete option (fix #66)
when set, discard an untracked file will actually delete this file
* support 'typechanged' git status type
* clear undo history after each update_buffer() call (refs #64)
undo in magit buffer did the user believe that it may undoes some vimagit
actions: it is not! magit buffer undo history is wiped at each refresh;
which means undo still works while the user is typing its commit message
* binary file detection is done with git diff (fix #60, #61)
it fixes false positive binary file detection, binary file detection on
Windows, and may eventually speed up the refresh process :)
* output an understandable message when user tries ot discard an untracked file (fix #58)
* remove unwanted --No lines in buffer-- in status line when opening magit buffer (fix #56)
* use 'diff -p' instead of 'diff --patch' (fix #52)
* better handling of some command line error code and improve some error messages
* set local foldnestmax (fix #62)
* fix next/prev jump folding
* fix modified/untracked content in submodule (fix #49)
* vimagit is now able to handle multiple git repositories (fix #44,#34,#29).
* add mappings N and P to jump to next and previous hunk (fix #25).
* reorder magit display: display modified files first.
* disable inline help by default (fix #46). It is always possible to switch
inline help display with 'h', or with g:magit_show_help
* rework magit buffer color syntax.
* display commit mode in Info section.
* rename magit buffer, now named after git repository path, e.g.
* add MagitOnly command. It can be used to craft a bash alias like:
alias magit='vim -c MagitOnly'
* safe and smart handling of quit command (fix #41,#43).
* close vimagit window if there is another window.
* switch to alternate buffer if any.
* close vim if magit buffer the only buffer.
* disable ':w' mapping, which was not safe. This feature will be re inserted
with a safer method later.
||Some bug fixes and performance improvements.
* smarter way to handle magit buffer:
- improve some internal mechanisms, which should improve performances for huge repositories
- by default, do not show untracked/deleted/added/renamed files diffs (ref #28)
see g:magit_default_show_all_files new behavior
* add g:magit_default_sections to let user choose which sections are displayed (fix #37) user can now choose which sections to display, and in which order
* magit buffer become empty after switching to other window and back (#35)
* remove warning when opening magit buffer
* check that magit buffer exists before removing it (refs #39)
* fix add binary file (fixes #27)
* fix some display problem (Unstaged changes may not be highlighted)
* fix reset and discard for binary files
* git works in a clean environment, without any configuration
||This is a major step for vimagit. It should now contain all primary command needed for staging. Then, this release should be the real 1.0 version.
* Stage parts of hunk (fixes #8 and #19)
* select some with v, then stage your selection with S
* stage a single line with L
* mark lines (can be non contiguous) with M, then stage marked lines in the hunk with S
* Stage single files in new directories (fixes #10)
* New options (fixes #18)
* g:magit_default_show_all_files to define if file diffs are shown or not at magit buffer opening.
* If magit buffer contains more than g:magit_warning_max_lines (default 10000) lines to display, user is asked if he wants to display all these lines.
* g:magit_default_fold_level to define foldlevel of magit buffer.
* These options can be overriden with new magit#show_magit() parameters (allowing user to define its own mappings/commands)
* File display is now sorted.
* Show submodule diffs (fixes #12)
* No bugs have been reported since release 1.3.
- hide file diffs: to hide/unhide diffs for a file, move the cursor to the filename and press (Enter). It allows vimagit to be fast when there is a lot of diffs in a repository.
- zo, zO, zc, zC mappings on a filename hide/unhide file diffs.
- modify hunk before staging: in the Magit buffer, it is possible to modify a hunk before staging it. Only '+' lines can be modified. No lines can be deleted or added for the moment. (fixes #9).
- handle new empty files and new symlink (fix #11).
- handle binary files (fix #13).
- stage/unstage/ignore/discard a file with cursor on the filename.
- add global mapping M to open magit buffer (it can be overwritten with g:magit_show_magit_mapping).
- remove 'C' default mapping.
- fix staging issue: sometimes, staging a hunk was failing.
- handle filenames with spaces.
- read COMMIT_EDITMSG only if exists (commit command failed for fresh new git directory)
- fix issue of some rare hunk staging (because of some whitespaces)
- stage/unstage/ignore on file header now works
- add info section (fix #6)
- add wrappers to system and systemlist, when vim doesn't support system with List (available since vim v7.4.248)
- fix git diff failing when cwd is not in top dir (it ends with an empty Magit buffer)
- ensure to not use external diff if any
- Check commentChar from git config
- default discard mapping is now DDD, to avoid mistype
- map :w<cr> to commit
- close Magit buffer with q
- put some first tests in regression, with travis