@@ -14,19 +14,23 @@ local telescope_ags_mappings = require("advanced_git_search.telescope.mappings")
14
14
15
15
local M = {}
16
16
17
+ local config = require (" advanced_git_search.utils.config" )
18
+
17
19
--- Opens a Telescope window with all files changed on the current branch
18
20
--- Only committed changes will be displayed
19
21
M .changed_on_branch = function ()
22
+ local theme_opts = config .telescope_theme (" changed_on_branch" )
23
+
20
24
pickers
21
- .new ({
25
+ .new (vim . tbl_extend ( " force " , {
22
26
results_title = " Modified "
23
27
.. git_utils .base_branch ()
24
28
.. " -> "
25
29
.. git_utils .current_branch (),
26
30
sorter = sorters .get_fuzzy_file (),
27
31
finder = telescope_ags_finders .changed_files_on_current_branch_finder (),
28
32
previewer = telescope_ags_previewers .changed_files_on_current_branch_previewer (),
29
- })
33
+ }, theme_opts ) )
30
34
:find ()
31
35
end
32
36
@@ -36,8 +40,10 @@ M.diff_branch_file = function()
36
40
local current_branch = git_utils .current_branch ()
37
41
local bufnr = vim .fn .bufnr ()
38
42
43
+ local theme_opts = config .telescope_theme (" diff_branch_file" )
44
+
39
45
pickers
40
- .new ({
46
+ .new (vim . tbl_extend ( " force " , {
41
47
results_title = " Local branches :: *" .. current_branch ,
42
48
prompt_title = " Branch name" ,
43
49
finder = telescope_ags_finders .git_branches_finder (),
@@ -51,7 +57,7 @@ M.diff_branch_file = function()
51
57
)
52
58
return true
53
59
end ,
54
- })
60
+ }, theme_opts ) )
55
61
:find ()
56
62
end
57
63
@@ -62,6 +68,8 @@ M.diff_commit_line = function()
62
68
local s_start = vim .fn .getpos (" '<" )[2 ]
63
69
local s_end = vim .fn .getpos (" '>" )[2 ]
64
70
71
+ local theme_opts = config .telescope_theme (" diff_commit_line" )
72
+
65
73
if s_start == 0 or s_end == 0 then
66
74
vim .notify (
67
75
" No visual selection" ,
@@ -74,7 +82,7 @@ M.diff_commit_line = function()
74
82
-- git log -L741,751:'app/models/patients/patient.rb'\
75
83
-- --format='%C(auto)%h \t %as \t %C(green)%an _ %Creset %s'
76
84
pickers
77
- .new ({
85
+ .new (vim . tbl_extend ( " force " , {
78
86
results_title = " Commits that affected the selected lines" ,
79
87
prompt_title = " Commit message" ,
80
88
finder = telescope_ags_finders .git_log_location_finder (
@@ -95,18 +103,20 @@ M.diff_commit_line = function()
95
103
telescope_ags_mappings .show_entire_commit (map )
96
104
return true
97
105
end ,
98
- })
106
+ }, theme_opts ) )
99
107
:find ()
100
108
end
101
109
102
110
--- Opens a Telescope window with a list of previous commits.
103
111
--- Query is used to filter the results based on the
104
112
--- content of the commit (added or removed text).
105
113
M .search_log_content = function ()
114
+ local theme_opts = config .telescope_theme (" search_log_content" )
115
+
106
116
-- git log -L741,751:'app/models/patients/patient.rb' \
107
117
-- --format='%C(auto)%h \t %as \t %C(green)%an _ %Creset %s'
108
118
pickers
109
- .new ({
119
+ .new (vim . tbl_extend ( " force " , {
110
120
results_title = " Commits" ,
111
121
prompt_title = " Git log content (added, removed or updated text)" ,
112
122
finder = telescope_ags_finders .git_log_content_finder ({}),
@@ -120,7 +130,7 @@ M.search_log_content = function()
120
130
telescope_ags_mappings .show_entire_commit (map )
121
131
return true
122
132
end ,
123
- })
133
+ }, theme_opts ) )
124
134
:find ()
125
135
end
126
136
@@ -129,10 +139,12 @@ M.search_log_content_file = function()
129
139
-- local file_name = vim.fn.expand("%")
130
140
-- local relative_file_name = vim.fn.expand("%:~:.")
131
141
142
+ local theme_opts = config .telescope_theme (" search_log_content_file" )
143
+
132
144
-- git log -L741,751:'app/models/patients/patient.rb' \
133
145
-- --format='%C(auto)%h \t %as \t %C(green)%an _ %Creset %s'
134
146
pickers
135
- .new ({
147
+ .new (vim . tbl_extend ( " force " , {
136
148
results_title = " Commits" ,
137
149
prompt_title = " Git log content (added, removed or updated text in this file)" ,
138
150
finder = telescope_ags_finders .git_log_content_finder ({
@@ -149,15 +161,18 @@ M.search_log_content_file = function()
149
161
150
162
return true
151
163
end ,
152
- })
164
+ }, theme_opts ) )
153
165
:find ()
154
166
end
155
167
156
168
-- Opens a Telescope window with a list of git commits which changed the current file (renames included)
157
169
M .diff_commit_file = function ()
158
170
local bufnr = vim .fn .bufnr ()
171
+
172
+ local theme_opts = config .telescope_theme (" search_log_content_file" )
173
+
159
174
pickers
160
- .new ({
175
+ .new (vim . tbl_extend ( " force " , {
161
176
results_title = " Commits that affected this file (renamed files included)" ,
162
177
prompt_title = " Commit message" ,
163
178
finder = telescope_ags_finders .git_log_file_finder (bufnr ),
@@ -175,14 +190,16 @@ M.diff_commit_file = function()
175
190
176
191
return true
177
192
end ,
178
- })
193
+ }, theme_opts ) )
179
194
:find ()
180
195
end
181
196
182
197
--- Opens a Telescope window with all reflog entries
183
198
M .checkout_reflog = function ()
199
+ local theme_opts = config .telescope_theme (" checkout_reflog" )
200
+
184
201
pickers
185
- .new ({
202
+ .new (vim . tbl_extend ( " force " , {
186
203
results_title = " Git Reflog, <CR> to checkout" ,
187
204
finder = finders .new_oneshot_job (
188
205
require (" advanced_git_search.commands.find" ).reflog ()
@@ -192,16 +209,18 @@ M.checkout_reflog = function()
192
209
telescope_ags_mappings .checkout_reflog_entry (map )
193
210
return true
194
211
end ,
195
- })
212
+ }, theme_opts ) )
196
213
:find ()
197
214
end
198
215
199
216
--- Opens a selector for all advanced git search functions
200
217
M .show_custom_functions = function ()
201
218
local keys = global_picker .keys (" telescope" )
202
219
220
+ local theme_opts = config .telescope_theme (" show_custom_functions" )
221
+
203
222
pickers
204
- .new ({
223
+ .new (vim . tbl_extend ( " force " , {
205
224
prompt_title = " Git actions" ,
206
225
finder = finders .new_table (keys ),
207
226
sorter = sorters .get_fuzzy_file (),
@@ -221,7 +240,7 @@ M.show_custom_functions = function()
221
240
222
241
return true
223
242
end ,
224
- })
243
+ }, theme_opts ) )
225
244
:find ()
226
245
end
227
246
0 commit comments