File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -38,3 +38,15 @@ _G._toggle_lazygit = function()
38
38
vim .notify (" Command [lazygit] not found!" , vim .log .levels .ERROR , { title = " toggleterm.nvim" })
39
39
end
40
40
end
41
+
42
+ _G ._buf_vtext = function ()
43
+ local a_orig = vim .fn .getreg (" a" )
44
+ local mode = vim .fn .mode ()
45
+ if mode ~= " v" and mode ~= " V" then
46
+ vim .cmd ([[ normal! gv]] )
47
+ end
48
+ vim .cmd ([[ silent! normal! "aygv]] )
49
+ local text = vim .fn .getreg (" a" )
50
+ vim .fn .setreg (" a" , a_orig )
51
+ return text
52
+ end
Original file line number Diff line number Diff line change @@ -132,6 +132,12 @@ local plug_map = {
132
132
:with_desc (" edit: Change current direrctory by zoxide" ),
133
133
[" n|<leader>fb" ] = map_cu (" Telescope buffers" ):with_noremap ():with_silent ():with_desc (" find: Buffer opened" ),
134
134
[" n|<leader>fs" ] = map_cu (" Telescope grep_string" ):with_noremap ():with_silent ():with_desc (" find: Current word" ),
135
+ [" v|<leader>fs" ] = map_callback (function ()
136
+ require (" telescope.builtin" ).grep_string ({ search = _buf_vtext () }) -- luacheck: ignore
137
+ end )
138
+ :with_noremap ()
139
+ :with_silent ()
140
+ :with_desc (" find: Selection text" ),
135
141
[" n|<leader>fd" ] = map_cu (" Telescope persisted" ):with_noremap ():with_silent ():with_desc (" find: Session" ),
136
142
137
143
-- Plugin: dap
You can’t perform that action at this time.
0 commit comments