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
2
6
3
7
## 🖥️ Usage
4
8
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 )
6
10
7
11
### 📖 Open a picker
8
12
13
+ #### 🔭 Telescope
14
+
9
15
``` vim
10
16
:Telescope advanced_git_search {function_name}
11
17
```
12
18
13
- #### or in lua
19
+ > or in lua
14
20
15
21
``` lua
16
22
require (' telescope' ).extensions .advanced_git_search .{function_name }()
17
23
```
18
24
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
20
36
21
37
execute ` :AdvancedGitSearch ` , choose your picker and press ` <CR> `
22
38
23
39
### 🔎 Enter a query
24
40
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.
26
42
27
43
### ✏️ Further search on commit author with ` @ `
28
44
@@ -33,7 +49,7 @@ the author name.
33
49
34
50
### 1. search_log_content -- Search in repo log content
35
51
36
- Opens a Telescope window with a list of all previous commit.
52
+ Opens a window with a list of all previous commit.
37
53
38
54
_ Grep behaviour_ : filter on added, updated or removed code (log content: ` -G ` option in git).
39
55
@@ -46,7 +62,7 @@ _Grep behaviour_: filter on added, updated or removed code (log content: `-G` op
46
62
47
63
### 2. search_log_content_file -- Search in file log content
48
64
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
50
66
current file (renames included).
51
67
52
68
_ 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
60
76
61
77
### 3. diff_commit_file -- Diff current file with commit
62
78
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
64
80
current file (renames included).
65
81
66
82
_ Grep behaviour_ : filter on commit message.
@@ -74,19 +90,18 @@ _Grep behaviour_: filter on commit message.
74
90
75
91
### 4. diff_commit_line -- Diff current file with selected line history
76
92
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
78
94
selected lines
79
95
80
96
_ Grep behaviour_ : filter on commit message.
81
97
82
98
#### How to use
83
99
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
+ > ```
90
105
91
106
First you have to select the lines in visual mode, then go back to normal
92
107
mode and execute this command.
@@ -107,7 +122,7 @@ vim.api.nvim_set_keymap(
107
122
)
108
123
```
109
124
110
- No extra setup is needed when you use ` :AdvancedGitSearch ` .
125
+ > No extra setup is needed when you use ` :AdvancedGitSearch ` .
111
126
112
127
#### _ Keymaps_
113
128
@@ -118,7 +133,7 @@ No extra setup is needed when you use `:AdvancedGitSearch`.
118
133
119
134
### 5. diff_branch_file -- Diff file with branch
120
135
121
- Opens a Telescope window with a list of local branches
136
+ Opens a window with a list of local branches
122
137
123
138
_ Grep behaviour_ : filter on branch name.
124
139
@@ -128,7 +143,7 @@ _Grep behaviour_: filter on branch name.
128
143
129
144
### 6. changed_on_branch -- Changed on current branch (experimental)
130
145
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).
132
147
The fork point of the current branch is determined with the following command:
133
148
134
149
``` sh
@@ -150,7 +165,7 @@ _Grep behaviour_: filter on filename.
150
165
151
166
### 7. checkout_reflog -- Checkout from reflog
152
167
153
- Opens a Telescope window with all reflog entries
168
+ Opens a window with all reflog entries
154
169
155
170
#### _ Keymaps_
156
171
@@ -159,10 +174,12 @@ Opens a Telescope window with all reflog entries
159
174
### 8. show_custom_functions
160
175
161
176
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.
163
178
164
179
## ⚙️ Installation
165
180
181
+ ### Telescope
182
+
166
183
With Lazy
167
184
168
185
``` lua
@@ -243,6 +260,75 @@ With Packer
243
260
})
244
261
```
245
262
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
+
246
332
### Prerequisites
247
333
248
334
- git
0 commit comments