Skip to content

Commit 5f271b4

Browse files
committed
Update readme
Signed-off-by: Aaron Hallaert <[email protected]>
1 parent f3e4287 commit 5f271b4

File tree

1 file changed

+101
-19
lines changed

1 file changed

+101
-19
lines changed

README.md

Lines changed: 101 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,39 @@
22

33
## 🖥️ Usage
44

5-
[![Demo](https://img.youtube.com/vi/bO0uYLlHtYo/0.jpg)](https://www.youtube.com/watch?v=bO0uYLlHtYo)
5+
- [Demo](https://www.youtube.com/watch?v=bO0uYLlHtYo)
66

77
### 📖 Open a picker
88

9+
#### 🔭 Telescope
10+
911
```vim
1012
:Telescope advanced_git_search {function_name}
1113
```
1214

13-
#### or in lua
15+
> or in lua
1416
1517
```lua
1618
require('telescope').extensions.advanced_git_search.{function_name}()
1719
```
1820

19-
#### or through another Telescope picker
21+
> or through another Telescope picker
22+
23+
execute `:AdvancedGitSearch`, choose your picker and press `<CR>`
24+
25+
#### 🧎 fzf-lua
26+
27+
```lua
28+
require('advanced-git-search.fzf').{function_name}()
29+
```
30+
31+
> or through another picker
2032
2133
execute `:AdvancedGitSearch`, choose your picker and press `<CR>`
2234

2335
### 🔎 Enter a query
2436

25-
Your usual telescope experience. See the individual commands for the grep behaviour.
37+
Your usual search experience. See the individual commands for the grep behaviour.
2638

2739
### ✏️ Further search on commit author with `@`
2840

@@ -33,7 +45,7 @@ the author name.
3345

3446
### 1. search_log_content -- Search in repo log content
3547

36-
Opens a Telescope window with a list of all previous commit.
48+
Opens a window with a list of all previous commit.
3749

3850
_Grep behaviour_: filter on added, updated or removed code (log content: `-G` option in git).
3951

@@ -46,7 +58,7 @@ _Grep behaviour_: filter on added, updated or removed code (log content: `-G` op
4658

4759
### 2. search_log_content_file -- Search in file log content
4860

49-
Opens a Telescope window with a list of git commits that changed the
61+
Opens a window with a list of git commits that changed the
5062
current file (renames included).
5163

5264
_Grep behaviour_: filter on added, updated or removed code (log content: `-G` option in git).
@@ -60,7 +72,7 @@ _Grep behaviour_: filter on added, updated or removed code (log content: `-G` op
6072

6173
### 3. diff_commit_file -- Diff current file with commit
6274

63-
Opens a Telescope window with a list of git commits that changed the
75+
Opens a window with a list of git commits that changed the
6476
current file (renames included).
6577

6678
_Grep behaviour_: filter on commit message.
@@ -74,19 +86,18 @@ _Grep behaviour_: filter on commit message.
7486

7587
### 4. diff_commit_line -- Diff current file with selected line history
7688

77-
Opens a Telescope window with a list of previous commit logs with respect to
89+
Opens a window with a list of previous commit logs with respect to
7890
selected lines
7991

8092
_Grep behaviour_: filter on commit message.
8193

8294
#### How to use
8395

84-
_The following only applies when you use one of the commands below._
85-
86-
```vim
87-
:Telescope advanced_git_search diff_commit_line
88-
:lua require('telescope').extensions.advanced_git_search.diff_commit_line()
89-
```
96+
> _This workaround only applies when you use the following command. (Telescope)_
97+
>
98+
> ```vim
99+
> :Telescope advanced_git_search diff_commit_line
100+
> ```
90101
91102
First you have to select the lines in visual mode, then go back to normal
92103
mode and execute this command.
@@ -107,7 +118,7 @@ vim.api.nvim_set_keymap(
107118
)
108119
```
109120
110-
No extra setup is needed when you use `:AdvancedGitSearch`.
121+
> No extra setup is needed when you use `:AdvancedGitSearch`.
111122
112123
#### _Keymaps_
113124

@@ -118,7 +129,7 @@ No extra setup is needed when you use `:AdvancedGitSearch`.
118129

119130
### 5. diff_branch_file -- Diff file with branch
120131

121-
Opens a Telescope window with a list of local branches
132+
Opens a window with a list of local branches
122133

123134
_Grep behaviour_: filter on branch name.
124135

@@ -128,7 +139,7 @@ _Grep behaviour_: filter on branch name.
128139

129140
### 6. changed_on_branch -- Changed on current branch (experimental)
130141

131-
Opens a Telescope window with a list of changed files on the current branch (including staged files).
142+
Opens a window with a list of changed files on the current branch (including staged files).
132143
The fork point of the current branch is determined with the following command:
133144

134145
```sh
@@ -150,7 +161,7 @@ _Grep behaviour_: filter on filename.
150161

151162
### 7. checkout_reflog -- Checkout from reflog
152163

153-
Opens a Telescope window with all reflog entries
164+
Opens a window with all reflog entries
154165

155166
#### _Keymaps_
156167

@@ -159,10 +170,12 @@ Opens a Telescope window with all reflog entries
159170
### 8. show_custom_functions
160171

161172
A telescope picker for all functions above.
162-
Enable `show_builtin_git_pickers` to additionally show Telescopes builtin git pickers.
173+
Enable `show_builtin_git_pickers` to additionally show builtin git pickers.
163174

164175
## ⚙️ Installation
165176

177+
### Telescope
178+
166179
With Lazy
167180

168181
```lua
@@ -243,6 +256,75 @@ With Packer
243256
})
244257
```
245258

259+
### Fzf-lua
260+
261+
With Lazy
262+
263+
```lua
264+
{
265+
"aaronhallaert/advanced-git-search.nvim",
266+
config = function()
267+
-- optional: setup telescope before loading the extension
268+
require("advanced-git-search.fzf").setup{
269+
-- fugitive or diffview
270+
diff_plugin = "fugitive",
271+
-- customize git in previewer
272+
-- e.g. flags such as { "--no-pager" }, or { "-c", "delta.side-by-side=false" }
273+
git_flags = {},
274+
-- customize git diff in previewer
275+
-- e.g. flags such as { "--raw" }
276+
git_diff_flags = {},
277+
-- Show builtin git pickers when executing "show_custom_functions" or :AdvancedGitSearch
278+
show_builtin_git_pickers = false,
279+
}
280+
end,
281+
dependencies = {
282+
"nvim-telescope/telescope.nvim",
283+
-- to show diff splits and open commits in browser
284+
"tpope/vim-fugitive",
285+
-- to open commits in browser with fugitive
286+
"tpope/vim-rhubarb",
287+
-- OPTIONAL: to replace the diff from fugitive with diffview.nvim
288+
-- (fugitive is still needed to open in browser)
289+
-- "sindrets/diffview.nvim",
290+
},
291+
}
292+
```
293+
294+
With Packer
295+
296+
```lua
297+
use({
298+
"aaronhallaert/advanced-git-search.nvim",
299+
config = function()
300+
-- optional: setup telescope before loading the extension
301+
require("advanced-git-search.fzf").setup{
302+
-- Fugitive or diffview
303+
diff_plugin = "fugitive",
304+
-- Customize git in previewer
305+
-- e.g. flags such as { "--no-pager" }, or { "-c", "delta.side-by-side=false" }
306+
git_flags = {},
307+
-- Customize git diff in previewer
308+
-- e.g. flags such as { "--raw" }
309+
git_diff_flags = {},
310+
-- Show builtin git pickers when executing "show_custom_functions" or :AdvancedGitSearch
311+
show_builtin_git_pickers = false,
312+
}
313+
}
314+
end,
315+
requires = {
316+
"nvim-telescope/telescope.nvim",
317+
-- to show diff splits and open commits in browser
318+
"tpope/vim-fugitive",
319+
-- to open commits in browser with fugitive
320+
"tpope/vim-rhubarb",
321+
-- optional: to replace the diff from fugitive with diffview.nvim
322+
-- (fugitive is still needed to open in browser)
323+
-- "sindrets/diffview.nvim",
324+
},
325+
})
326+
```
327+
246328
### Prerequisites
247329

248330
- git

0 commit comments

Comments
 (0)