Skip to content

Commit f8e8964

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

File tree

1 file changed

+106
-20
lines changed

1 file changed

+106
-20
lines changed

README.md

Lines changed: 106 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
1-
# Telescope Advanced Git Search
1+
# Advanced Git Search
2+
3+
An advanced git search extension for `Telescope` and `fzf-lua`.
4+
5+
Search your git history by commit message, content and author in Neovim
26

37
## 🖥️ Usage
48

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

711
### 📖 Open a picker
812

13+
#### 🔭 Telescope
14+
915
```vim
1016
:Telescope advanced_git_search {function_name}
1117
```
1218

13-
#### or in lua
19+
> or in lua
1420
1521
```lua
1622
require('telescope').extensions.advanced_git_search.{function_name}()
1723
```
1824

19-
#### or through another Telescope picker
25+
> or through another Telescope picker
26+
27+
execute `:AdvancedGitSearch`, choose your picker and press `<CR>`
28+
29+
#### 🧎 fzf-lua
30+
31+
```lua
32+
require('advanced-git-search.fzf').{function_name}()
33+
```
34+
35+
> or through another picker
2036
2137
execute `:AdvancedGitSearch`, choose your picker and press `<CR>`
2238

2339
### 🔎 Enter a query
2440

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

2743
### ✏️ Further search on commit author with `@`
2844

@@ -33,7 +49,7 @@ the author name.
3349

3450
### 1. search_log_content -- Search in repo log content
3551

36-
Opens a Telescope window with a list of all previous commit.
52+
Opens a window with a list of all previous commit.
3753

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

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

4763
### 2. search_log_content_file -- Search in file log content
4864

49-
Opens a Telescope window with a list of git commits that changed the
65+
Opens a window with a list of git commits that changed the
5066
current file (renames included).
5167

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

6177
### 3. diff_commit_file -- Diff current file with commit
6278

63-
Opens a Telescope window with a list of git commits that changed the
79+
Opens a window with a list of git commits that changed the
6480
current file (renames included).
6581

6682
_Grep behaviour_: filter on commit message.
@@ -74,19 +90,18 @@ _Grep behaviour_: filter on commit message.
7490

7591
### 4. diff_commit_line -- Diff current file with selected line history
7692

77-
Opens a Telescope window with a list of previous commit logs with respect to
93+
Opens a window with a list of previous commit logs with respect to
7894
selected lines
7995

8096
_Grep behaviour_: filter on commit message.
8197

8298
#### How to use
8399

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-
```
100+
> _This workaround only applies when you use the following command. (Telescope)_
101+
>
102+
> ```vim
103+
> :Telescope advanced_git_search diff_commit_line
104+
> ```
90105
91106
First you have to select the lines in visual mode, then go back to normal
92107
mode and execute this command.
@@ -107,7 +122,7 @@ vim.api.nvim_set_keymap(
107122
)
108123
```
109124
110-
No extra setup is needed when you use `:AdvancedGitSearch`.
125+
> No extra setup is needed when you use `:AdvancedGitSearch`.
111126
112127
#### _Keymaps_
113128

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

119134
### 5. diff_branch_file -- Diff file with branch
120135

121-
Opens a Telescope window with a list of local branches
136+
Opens a window with a list of local branches
122137

123138
_Grep behaviour_: filter on branch name.
124139

@@ -128,7 +143,7 @@ _Grep behaviour_: filter on branch name.
128143

129144
### 6. changed_on_branch -- Changed on current branch (experimental)
130145

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

134149
```sh
@@ -150,7 +165,7 @@ _Grep behaviour_: filter on filename.
150165

151166
### 7. checkout_reflog -- Checkout from reflog
152167

153-
Opens a Telescope window with all reflog entries
168+
Opens a window with all reflog entries
154169

155170
#### _Keymaps_
156171

@@ -159,10 +174,12 @@ Opens a Telescope window with all reflog entries
159174
### 8. show_custom_functions
160175

161176
A telescope picker for all functions above.
162-
Enable `show_builtin_git_pickers` to additionally show Telescopes builtin git pickers.
177+
Enable `show_builtin_git_pickers` to additionally show builtin git pickers.
163178

164179
## ⚙️ Installation
165180

181+
### Telescope
182+
166183
With Lazy
167184

168185
```lua
@@ -243,6 +260,75 @@ With Packer
243260
})
244261
```
245262

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

248334
- git

0 commit comments

Comments
 (0)