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