Skip to content

Commit

Permalink
Merge pull request #7 from jreybert/next
Browse files Browse the repository at this point in the history
Ready to release 1.2
  • Loading branch information
jreybert committed Oct 8, 2015
2 parents 610a7e7 + db72f82 commit 8d5f913
Show file tree
Hide file tree
Showing 21 changed files with 826 additions and 253 deletions.
58 changes: 50 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,70 @@
language: vim

sudo: false
branches:
only:
- master
- next

os:
- linux
- osx

env:
matrix:
- TEST_SUB_PATH=./
- TEST_SUB_PATH=books/templates/
- VIM_VERSION=normal
- VIM_VERSION=last
- VIM_VERSION=neovim
- VIM_VERSION=macvim

matrix:
allow_failures:
exclude:
- os: osx
env: VIM_VERSION=last
# neovim build fails with homebrew
# Error: undefined method `desc' for Neovim:Class
- os: osx
env: VIM_VERSION=neovim
- os: linux
env: VIM_VERSION=macvim

install:
- if [ "$TRAVIS_OS_NAME" = 'osx' ]; then
if [ "$VIM_VERSION" = 'neovim' ]; then
brew tap neovim/neovim &&
brew tap --repair &&
brew install --HEAD neovim;
elif [ "$VIM_VERSION" = 'macvim' ]; then
brew install macvim;
elif [ "$VIM_VERSION" = 'normal' ]; then
echo "use normal vim";
else
echo "VIM_VERSION is not set";
exit 1;
fi
elif [ "$TRAVIS_OS_NAME" = 'linux' ]; then
if [ "$VIM_VERSION" = 'last' ]; then
sudo add-apt-repository -y ppa:fcwu-tw/ppa &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install vim;
elif [ "$VIM_VERSION" = 'neovim' ]; then
sudo add-apt-repository -y ppa:neovim-ppa/unstable &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install neovim;
elif [ "$VIM_VERSION" = 'normal' ]; then
echo "use normal vim";
else
echo "VIM_VERSION is not set";
exit 1;
fi
fi

before_script:
- git clone https://github.com/jreybert/djooks
- git clone https://github.com/junegunn/vader.vim

script:
- ./test/run.sh . vader.vim djooks

install: true
- ./test/run.sh . vader.vim djooks $VIM_VERSION

after_success:
- ./test/merge.sh
74 changes: 41 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ More to come:

## Usage

IMPORTANT: mappings can have different meanings regarding the cursor position.
**:Magit**
The main magical command, showing vimagit buffer.

### Sections:

IMPORTANT: mappings can have different meanings regarding the cursor position.

There are 3 sections:
* Commit message: this section appears in commit mode (see below). It
contains the message to be commited.
Expand All @@ -60,38 +63,43 @@ There are 3 sections:

These mappings work in normal mode. They can be redefined.

S if cursor is in a hunk, stage/unstage hunk at
cursor position
if cursor is in diff header, stage/unstage whole file
at cursor position
When cursor is in "Unstaged changes" section, it will
stage the hunk/file.
On the other side, when cursor is in "Staged changes"
section, it will unstage hunk/file.
F stage/unstage the whole file at cursor position
When cursor is in "Unstaged changes" section, it will
stage the file.
On the other side, when cursor is in "Staged changes"
section, it will unstage file.
DDD if cursor is in a hunk, discard hunk at cursor position
if cursor is in diff header, discard whole file at
cursor position
When cursor is in "Unstaged changes" section, it will
discard the hunk/file.
R refresh vimagit buffer
C,CC,:w<cr> if not in commit section, set commit mode to "New
commit" and show "Commit message" section with brand new
commit message
if in commit section, commit the all staged changes in
commit mode previously set
CA if not in commit section, set commit mode to "Amend
commit" and show "Commit message" section with previous
commit message
if in commit section, commit the staged changes in
commit mode previously set
CF amend the staged changes into the previous commit,
without modifying previous commit message
I add the file under the cursor in .gitgnore
**S**
* If cursor is in a hunk, stage/unstage hunk at cursor position.
* If cursor is in diff header, stage/unstage whole file at cursor position.
* When cursor is in "Unstaged changes" section, it will stage the hunk/file.
* On the other side, when cursor is in "Staged changes" section, it will unstage hunk/file.

**F**
* Stage/unstage the whole file at cursor position.
* When cursor is in "Unstaged changes" section, it will stage the file.
* On the other side, when cursor is in "Staged changes" section, it will unstage file.

**DDD**
* If cursor is in a hunk, discard hunk at cursor position.
* If cursor is in diff header, discard whole file at cursor position.
* Only works in "Unstaged changes" section.

**C**
**CC**
**:w<cr>**
* If not in commit section, set commit mode to "New commit" and show "Commit message" section with brand new commit message.
* If in commit section, commit the all staged changes in commit mode previously set.

**CA**
* If not in commit section, set commit mode to "Amend commit" and show "Commit message" section with previous commit message.
* If in commit section, commit the staged changes in commit mode previously set.

**CF**
* Amend the staged changes into the previous commit, without modifying previous commit message.

**I**
* Add the file under the cursor in .gitgnore

**R**
* Refresh vimagit buffer

**h**
* Toggle help showing in magit buffer

## Installation

Expand Down
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
* fix new empty file staging
* add tests
* add tutorial
* fix new/renamed file diff: it gives an absolute pathname, which is wrong fir diff
1 change: 1 addition & 0 deletions common/magit_common.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
" These are used to beautify the magit buffer and to help for some block
" selection
let g:magit_sections = {
\ 'info': 'Info',
\ 'staged': 'Staged changes',
\ 'unstaged': 'Unstaged changes',
\ 'commit_start': 'Commit message',
Expand Down
119 changes: 69 additions & 50 deletions doc/vimagit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@ Plugin Homepage: <https://github.com/jreybert/vimagit>
----- ~

===============================================================================
CONTENTS *vimagitContents*
CONTENTS *vimagit-contents*

1. Introduction ................. |vimagitIntroduction|
2. Installation ................. |vimagitInstallation|
3. Usage ........................ |vimagitUsage|
4. Commands ..................... |vimagitCommands|
5. Customization ................ |vimagitCustomization|
6. FAQ .......................... |vimagitFAQ|
1. Introduction ................. |vimagit-introduction|
2. Installation ................. |vimagit-installation|
3. Usage ........................ |vimagit-usage|
4. Commands ..................... |vimagit-commands|
5. Customization ................ |vimagit-customization|
6. FAQ .......................... |vimagit-FAQ|


===============================================================================
1. INTRODUCTION *vimagitIntroduction*
*vimagit*
1. INTRODUCTION *vimagit-introduction*

vimagit is a plugin which try to mimic the fantastic magit emacs plugin. If you
already know the original plugin, give it a try. If you never have heard about
magit (or maybe emacs), this is IMO the most efficient way to stage hunks and
craft nice commits.

===============================================================================
2. INSTALLATION *vimagitInstallation*
2. INSTALLATION *vimagit-installation*

The plugin hierarchy tree respects the vim plugin standard. It is compatible
with pathogen (and most probably vundle).
Expand All @@ -43,18 +42,23 @@ To install:
<

===============================================================================
3. USAGE *vimagitUsage*
3. USAGE *vimagit-usage*

In a git'ed source directory, once you have some unstaged work, simply type
with :Magit , and here is the magic. A new window appears, with all the diffs
and new files in your directory.

===============================================================================
4. COMMANDS *vimagitCommands*
4. COMMANDS *vimagit-commands*

IMPORTANT: mappings can have different meanings regarding the cursor position.

Sections:
*:Magit* *magit#show_magit('v')*
:Magit the main magical command, showing vimagit buffer

Sections: *vimagit-sections*
---------

IMPORTANT: mappings can have different meanings regarding the cursor position.

There are 3 sections:
* Commit message: this section appears in commit mode (see below). It
Expand All @@ -65,45 +69,60 @@ There are 3 sections:
files/hunks.
* Stash list: this section contains all stahes.

These mappings work in normal mode.

S if cursor is in a hunk, stage/unstage hunk at
cursor position
if cursor is in diff header, stage/unstage whole file
at cursor position
When cursor is in "Unstaged changes" section, it will
stage the hunk/file.
On the other side, when cursor is in "Staged changes"
section, it will unstage hunk/file.
F stage/unstage the whole file at cursor position
When cursor is in "Unstaged changes" section, it will
stage the file.
On the other side, when cursor is in "Staged changes"
section, it will unstage file.
DDD if cursor is in a hunk, discard hunk at cursor position
if cursor is in diff header, discard whole file at
cursor position
When cursor is in "Unstaged changes" section, it will
discard the hunk/file.
R refresh vimagit buffer
C,CC,:w<cr> if not in commit section, set commit mode to "New
commit" and show "Commit message" section with brand new
commit message
if in commit section, commit the all staged changes in
commit mode previously set
CA if not in commit section, set commit mode to "Amend
commit" and show "Commit message" section with previous
commit message
if in commit section, commit the staged changes in
commit mode previously set
CF amend the staged changes into the previous commit,
without modifying previous commit message
I add the file under the cursor in .gitgnore
These mappings work in normal mode. *vimagit-mappings*

*vimagit-S* *magit#stage_hunk()*
S If cursor is in a hunk, stage/unstage hunk at cursor position.
If cursor is in diff header, stage/unstage whole file at cursor
position.
When cursor is in "Unstaged changes" section, it will stage the
hunk/file.
On the other side, when cursor is in "Staged changes" section, it
will unstage hunk/file.

*vimagit-F* *magit#stage_file()*
F Stage/unstage the whole file at cursor position.
When cursor is in "Unstaged changes" section, it will stage the
file.
On the other side, when cursor is in "Staged changes" section, it
will unstage file.


*vimagit-DDD* *magit#discard_hunk()*
DDD If cursor is in a hunk, discard hunk at cursor position.
If cursor is in diff header, discard whole file at cursor
position.
Only works in "Unstaged changes" section.

*vimagit-C* *vimagit-CC* *vimagit-:w<cr>* *magit#commit_command('CC')*
C,CC, If not in commit section, set commit mode to "New commit" and show
:w<cr> "Commit message" section with brand new commit message.
If in commit section, commit the all staged changes in commit mode
previously set.

*vimagit-CA* *magit#commit_command('CA')*
CA If not in commit section, set commit mode to "Amend commit" and
show "Commit message" section with previous commit message.
If in commit section, commit the staged changes in commit mode
previously set.

*vimagit-CF* *magit#commit_command('CF')*
CF Amend the staged changes into the previous commit, without
modifying previous commit message

*vimagit-I* *magit#ignore_file()*
I Add the file under the cursor in .gitgnore

*vimagit-R* *magit#update_buffer()*
R Refresh vimagit buffer.

*vimagit-h* *magit#toggle_help()*
h Toggle help showing in magit buffer


===============================================================================
5. CUSTOMISATION *vimagitCustomization*
5. CUSTOMISATION *vimagit-customization*

===============================================================================
6. FAQ *vimagitFAQ*
6. FAQ *vimagit-FAQ*

Loading

0 comments on commit 8d5f913

Please sign in to comment.