Skip to content

Commit 6d3b18c

Browse files
committed
Merge branch 'v2'
2 parents c880254 + e091716 commit 6d3b18c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5353
-3409
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,26 @@ jobs:
88
matrix:
99
include:
1010
- vim_type: "Vim"
11-
vim_version: "v8.2.2277"
12-
vspec_vim: "vim"
11+
vim_version: "v8.2.4212"
12+
lua_version: "luajit-2.1.0-beta3"
13+
nvim: "false"
1314
- vim_type: "Neovim"
1415
vim_version: "stable"
15-
vspec_vim: "nvim"
16+
nvim: "true"
1617
steps:
1718
- name: "checkout"
1819
uses: "actions/checkout@v2"
1920
with:
2021
fetch-depth: 5
22+
- name: "install lua"
23+
uses: "leafo/[email protected]"
24+
with:
25+
luaVersion: "${{ matrix.lua_version }}"
26+
if: "${{ matrix.lua_version }}"
2127
- name: "install ${{ matrix.vim_type }}"
2228
uses: "thinca/action-setup-vim@v1"
2329
with:
2430
vim_version: "${{ matrix.vim_version }}"
2531
vim_type: "${{ matrix.vim_type }}"
26-
- name: "install ruby"
27-
uses: "ruby/setup-ruby@v1"
28-
with:
29-
ruby-version: "3.0"
30-
bundler-cache: true
3132
- name: "run tests"
32-
run: |
33-
${{ matrix.vspec_vim }} --version
34-
script -qec " VSPEC_VIM=${{ matrix.vspec_vim }} rake test"
35-
lint:
36-
runs-on: "ubuntu-18.04"
37-
steps:
38-
- name: "checkout"
39-
uses: "actions/checkout@v2"
40-
- uses: actions/setup-python@v2
41-
with:
42-
python-version: "3.x"
43-
- name: "run vint"
44-
# Must remove syntax before linting
45-
# https://github.com/vim-jp/vim-vimlparser/issues/98
46-
# Must remove tests before linting
47-
# https://github.com/Vimjas/vint/issues/330
48-
run: |
49-
sudo python3 -m pip install vim-vint
50-
sed -i 's/^syntax .*//' syntax/floggraph.vim
51-
rm -rf t/
52-
vint --color .
33+
run: "NVIM=${{ matrix.nvim }} ./t/run.sh"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
tags
2-
.vim-flavor
2+
.test

CONTRIBUTING.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
# Contributing
22

33
The idea behind this plugin is to provide a fully featured Vim branch viewer as light as possible.
4-
Take advantage of Vim and fugitive's builtin features instead of recreating them.
4+
Take advantage of Vim and Fugitive's builtin features instead of recreating them whenever possible.
55
Let users customize how they use Flog so they can use their personal workflows and preferred interface.
66

77
## Running Tests
88

9-
Ensure you have `ruby` installed and run `rake test`.
10-
Tests are located at `t/*.vim` and use [vim-flavor](https://github.com/kana/vim-flavor).
9+
**Vim**:
10+
11+
```
12+
./t/run.sh
13+
```
14+
15+
**Neovim**:
16+
17+
```
18+
NVIM=true ./t/run.sh
19+
```
1120

1221
## Pull Request Process
1322

1423
1. Ensure changes to the code are simple, iterative, and consistent.
15-
2. Run [vint](https://github.com/Kuniwak/vint) in the root directory and make any necessary changes.
16-
3. Keep documentation easy to read, concise, and up-to-date.
24+
2. Keep documentation easy to read, concise, and up-to-date.
25+
3. Add/update tests if appropriate.

EXAMPLES.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,91 @@
22

33
## Checking Out a Branch
44

5-
1. Launch the graph with `:Flog` (if this runs slowly for you, see [FAQ](FAQ.md)).
6-
2. Make sure your commit is in the graph by pressing `a` to toggle showing all commits.
7-
3. Navigate to your branch. There are a few ways to do this:
8-
- Use builtin VIM navigation like `/`, `j`, `k`, etc.
5+
1. Open the git branch graph with `:Flog` (if this runs slowly for you, see [FAQ](FAQ.md)).
6+
2. Make sure your commit is in the git branch graph by pressing `a` to toggle showing all commits.
7+
3. Navigate to your branch. There are a couple ways to do this:
8+
- Use builtin Vim navigation like `/`, `j`, `k`, etc.
99
- Use `]r`/`[r` to jump between commits with refs.
10-
- Use `:Flogjump` to jump towards the commit with completion.
1110
4. Checkout the branch. There are also a few ways to do this:
12-
- Use `:Floggit checkout <Tab>`. This will complete the commit name.
13-
- Use the `git` mapping to prepopulate the command line with `:Floggit<Space>`, or use `co<Space>` for `:Floggit checkout<Space>`.
1411
- Use `cob` to checkout the first local branch name, or remote branch if it is not available.
15-
- Use `cot` to checkout the first branch name, setting it up to be tracked locally if it is a remote branch.
12+
- Use `col` to checkout the first branch name, setting it up to be tracked locally if it is a remote branch.
13+
- Use `:Floggit checkout <Tab>`.
14+
- Use the `git` mapping to prepopulate the command line with `:Floggit`, or use `co<Space>` for `:Floggit checkout<Space>`.
15+
- Using `:Floggit` lets you use completion for:
16+
- Options for git commands.
17+
- Git objects.
18+
- Contextual Flog items, such as branch names on the current line.
1619

1720
## Adding Default Arguments
1821

19-
Put this inside of your `.vimrc` to always launch Flog with the `-all` and `-max-count=2000` options:
22+
Put this inside of your `.vimrc` to always launch Flog with the `-no-merges` and `-max-count=2000` options:
2023

2124
```vim
22-
let g:flog_default_arguments = {
25+
let g:flog_default_opts = {
2326
\ 'max_count': 2000,
24-
\ 'all': 1,
27+
\ 'merges': 0,
2528
\ }
2629
```
2730

28-
You can use `:Flogsetargs` after the graph has launched to override these options:
31+
You can use `:Flogsetargs` after the git branch graph has launched to override these options:
2932

3033
```
3134
# Clear the max count
3235
Flogsetargs -max-count=
3336
# Increase the max count to 3000
3437
Flogsetargs -max-count=3000
38+
# Remove -no-merges
39+
Flogsetargs -merges
3540
# Clear out options
3641
Flogsetargs!
3742
```
3843

39-
If you don't want options to be cleared when you run `:Flogsetargs!` you can use `g:flog_permanent_default_arguments`.
44+
If you don't want options to be cleared when you run `:Flogsetargs!` you can use `g:flog_permanent_default_opts`.
4045
For example, if you want to always use the short date format:
4146

4247
```vim
43-
let g:flog_permanent_default_arguments = {
48+
let g:flog_permanent_default_opts = {
4449
\ 'date': 'short',
4550
\ }
4651
```
4752

4853
## Diffing Commits
4954

5055
There are several different ways to diff commits after launching Flog:
51-
- Press `dd` in normal mode to diff the commit under the cursor.
52-
- Visually select the commits and use `:Floggit diff <Tab>` to complete the commits at the beginning and end of the selection.
56+
- Press `dd` in normal mode to diff the commit under the cursor with `HEAD`.
57+
- Visually select the commits and use `:Floggit -s diff <Tab>` to complete the commits at the beginning and end of the selection.
5358
- Press `dd` in visual mode to diff the commits at the beginning and end of the selection
59+
- Press `d!` to diff the commit at the cursor and the commit that was previously opened with `<CR>`.
5460

5561
## Extension Example: Switch Diff Order
5662

57-
Instead of trying to provide settings for everything, Flog provides utility functions for customization.
63+
Flog has functions that allow you to easily define your own mappings and commands.
5864
This example shows how to switch the order of commits when diffing with `dd`.
5965

6066
Put this code inside of your `.vimrc`:
6167

6268
```vim
63-
augroup flog
64-
autocmd FileType floggraph nno <buffer> dd :<C-U>call flog#run_tmp_command('vertical belowright Git diff HEAD %h')<CR>
65-
autocmd FileType floggraph vno <buffer> dd :<C-U>call flog#run_tmp_command("vertical belowright Git diff %(h'>) %(h'<)")<CR>
69+
augroup MyFlogSettings
70+
autocmd FileType floggraph nno <buffer> dd :<C-U>exec flog#Format('vertical belowright Floggit -s -t diff HEAD %h')<CR>
71+
autocmd FileType floggraph vno <buffer> dd :<C-U>exec flog#Format("vertical belowright Floggit -s -t diff %(h'>) %(h'<)")<CR>
6672
augroup END
6773
```
6874

69-
`flog#run_tmp_command` tells flog to run the command and treat any windows it opens as temporary.
70-
You can also use `flog#run_command`, which runs a command using the same syntax without temporary windows.
75+
`Floggit` runs a command using Fugitive's `Git` command.
76+
The `-s` flag prevents the Flog buffer from updating after running the command.
77+
The `-t` flag treats any windows it opens as temporary side windows.
7178

72-
This function can use different special format specifiers, similar to `printf()`.
73-
In this case, `%h` will resolve to the hash on the current line, and `%(h'>) %(h'<)` will resolve to the hashes at the end and beginning of the visual selection.
79+
The `flog#Format()` function uses special format specifier items, similar to `printf()`, to get contextual information from Flog.
80+
81+
The `%h` format specifier item used here will resolve to the hash on the current line.
82+
`%(h'>) %(h'<)` will resolve to the hashes at the end and beginning of the visual selection.
7483

7584
When diffing with `dd`, Flog will now show a diff from bottom-to-top, instead of top-to-bottom.
76-
This is because `%(h'<)` and `%(h'>)` have been swapped from the default command.
85+
This is because `HEAD`/`%h` have been swapped in normal mode from the default command, and `%(h'<)`/`%(h'>)` have been swapped in visual mode.
7786

7887
See `:help flog-command-format` for more format specifiers.
7988
See `:help flog-functions` for more details about calling command functions.
80-
You can also view [the floggraph filetype script](https://github.com/rbong/vim-flog/blob/master/ftplugin/floggraph.vim), which effectively serves as further examples of Flog's utility functions.
89+
You can also view [the floggraph filetype script](https://github.com/rbong/vim-flog/blob/master/ftplugin/floggraph.vim), which contains more examples.
8190
Finally, if you would like to view user-created commands, check out the [Wiki](https://github.com/rbong/vim-flog/wiki/Custom-Commands).
8291

8392
## Additional Examples
@@ -91,5 +100,5 @@ Here are some brief ideas.
91100
- You can start/manage a bisect with `:Floggit` commands, taking advantage of completion, and toggle seeing the current commits in the bisect with `gb`.
92101
- You can view the history of a file next to the file itself with `:Flogsplit -path=%`.
93102
- You can view the history for a particular range of lines in a file by visually selecting it and then typing `:Flog`.
94-
This will display an inline patch, which you can trigger with `gp`.
95-
- If you haven't already, look through `:help flog`. There are many commands that still haven't been covered here.
103+
- This will display an inline patch, which you can trigger with `gp`.
104+
- If you haven't already, look through `:help flog`. There is much that still hasn't been covered here.

FAQ.md

Lines changed: 44 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,80 @@
22

33
## How do I get Flog to run faster?
44

5-
There are several ways to get Flog to run faster depending on what your exact issue is.
5+
The answer depends on your issue.
66

7-
**Specifying the max count**
7+
**Flog is slow the first time it runs for a repo**
88

9-
You may want to specify `-max-count=<count>`, or use `let g:flog_default_arguments = { 'max_count': <count> }`.
9+
The first time Flog runs for a repo, it runs `git commit-graph write`.
10+
This ultimately makes it run faster.
1011

11-
This restricts the log to displaying a certain number of commits.
12-
This will increase the speed at which Flog can redraw the commit graph, generally reducing lag.
13-
14-
If you need to jump forward/backwards in history by `<count>`, use `[[`/`]]`
15-
16-
**Pre-calculating the commit graph**
17-
18-
In very large repositories, the commit graph can take a long time to sort when you use `git log --graph` or run Flog, even with max count specified.
19-
In these cases you can pre-calculate the commit graph.
20-
21-
If you are running Git 2.24 or greater, it is enabled by default.
22-
Otherwise it can be enabled via:
12+
Disable this feature:
2313

2414
```
25-
git config --global core.commitGraph true
26-
git config --global gc.writeCommitGraph true
15+
let g:flog_write_commit_graph = 0
2716
```
2817

29-
After that, navigate to your repository and run `git commit-graph write`.
30-
31-
This command may still take a long time to run, but once it has been generated, `git log --graph` and Flog will run much faster.
32-
If you don't plan to view a large number of commits that aren't reachable, you can use `git commit-graph write --reachable` to speed up this process.
18+
Set args (defaults shown):
3319

34-
You may want to re-run this command regularly when there are enough new commits.
35-
36-
**Disabling graph mode**
37-
38-
If you want to skip generating a graph and use Flog just as a log viewer, you can pass `-no-graph` to Flog or use the `gx` binding to toggle the graph.
39-
This is equivalent to `git log --no-graph`.
40-
41-
If this is still too slow, it might be because Flog has to wait until the command completes to write output to the buffer.
42-
In these cases, you may want to resort to just using `git log` in the terminal.
20+
```
21+
let g:flog_write_commit_graph_args = '--reachable --progress'
22+
```
4323

44-
**Flog is still too slow**
24+
**Flog gets slower over time for repos**
4525

46-
Flog, unlike other branch viewers like `gitk`, is just a wrapper around `git log`.
47-
It just reads static output from the command after it finishes and writes it to a buffer.
48-
By contrast, `gitk` reads raw commit data, calculates the graph structure itself commit-by-commit, and updates the display, all without hanging.
26+
The commit graph will eventually become out of date.
4927

50-
This may change in the future, so check back.
28+
You can update it by running:
5129

52-
If you have any feedback about Flog's speed or any of the suggestions above, please see [this ongoing issue](https://github.com/rbong/vim-flog/issues/26).
30+
```
31+
git commit-graph write --reachable --progress
32+
```
5333

54-
## How do I get Flog to look nicer?
34+
**Flog takes a long time to load for many commits**
5535

56-
Flog struggles with highlighting since Vim is not built to highlight vertical columns.
36+
By default, Flog will shows 5,000 commits.
5737

58-
To use the same highlighting that `git log --graph` would use in the shell,
59-
[download the AnsiEsc.vim plugin](https://github.com/vim-scripts/AnsiEsc.vim),
60-
then add `let g:flog_use_ansi_esc = 1` to your `.vimrc`.
38+
Launch with less commits:
6139

62-
Note that using `AnsiEsc.vim` with Flog comes with a performance hit.
40+
```
41+
:Flog -max-count=2000
42+
```
6343

64-
Another option is to use a custom command to replace `git log --graph`.
65-
Some users prefer the look of [git-forest](https://github.com/rbong/git-scripts/blob/master/git-forest),
66-
pictured below.
44+
Launch with less commits by default:
6745

68-
![git-forest](img/git-forest.png)
46+
```
47+
let g:flog_permanent_default_opts = { 'max_count': 2000 }
48+
```
6949

70-
To use `git-forest` as a custom log command,
71-
[download it from here](https://github.com/rbong/git-scripts/blob/master/git-forest),
72-
and add it to your path, then add this to your `.vimrc`.
50+
**Flog takes a long time to load for complex git branch graphs**
7351

74-
```vim
75-
let g:flog_build_log_command_fn = 'flog#build_git_forest_log_command'
76-
```
52+
Toggle the graph with `gx` or launch with `:Flog -no-graph`.
7753

78-
## Why not just use the `git log --graph` command?
54+
**Other issues**
7955

80-
To interact with commits.
56+
Please [post an issue](https://github.com/rbong/vim-flog/issues/).
8157

82-
## Why have a branch viewer inside of Vim?
58+
## What are the differences with other branch viewers?
8359

84-
This allows seamlessly switching between navigating the commit history, running git commands, and editing files checked into git.
60+
[gv.vim](https://github.com/junegunn/gv.vim) is an ultra-light branch viewer.
8561

86-
It also prevents having to learn another git interface on top of [fugitive](https://github.com/tpope/vim-fugitive).
62+
[gitv](https://github.com/gregsexton/gitv) is a fully featured branch viewer.
8763

88-
If you want to know everything you can do with fugitive, I recommend [the Vimcasts fugitive series](http://vimcasts.org/blog/2011/05/the-fugitive-series/).
64+
Flog is faster than gitv.
65+
Flog is slower than gv.vim, but in many cases only marginally.
8966

90-
## What are the differences with other branch viewers?
67+
gv.vim and gitv rely on the output of `git log --graph`.
68+
Flog draws the git branch graph itself.
69+
This allows for branch highlighting and beautiful git branch graphs.
9170

92-
[gv.vim](https://github.com/junegunn/gv.vim) is an ultra-light branch viewer, whereas Flog is fully featured.
93-
Flog allows updating the graph, running commands, and customization, where gv does not.
71+
Flog is more customizable and flexible than gitv.
72+
gv.vim does not have any customization or flexibility by design.
9473

95-
[gitv](https://github.com/gregsexton/gitv) is another fully featured branch viewer.
96-
Flog is a next generation branch viewer that learns a lot of lessons from gitv.
97-
It has a better defined argument system, more robust window management, more stable update system, has the ability to run more commands in the graph easier, has cleaner mappings, and supports any log format.
74+
Flog has features which have no equivalent in either of the other branch viewers.
75+
This includes commit marks, some navigation mappings, and contextually aware command completion.
9876

9977
## How can I learn how to use flog?
10078

10179
See `:help flog` for all commands and options.
102-
See [the examples](EXAMPLES.md) for detailed walkthroughs of different operations using flog.
103-
Please [post an issue](https://github.com/rbong/vim-flog/issues) if you have any questions on how to do anything.
80+
See [examples](EXAMPLES.md) for detailed walkthroughs.
81+
Please [post an issue](https://github.com/rbong/vim-flog/issues) if you have any questions.

Flavorfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

Flavorfile.lock

Lines changed: 0 additions & 2 deletions
This file was deleted.

Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

Gemfile.lock

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)