1- _G ._command_panel = function ()
2- require (" telescope.builtin" ).keymaps ({
3- lhs_filter = function (lhs )
4- return not string.find (lhs , " Þ" )
5- end ,
6- })
7- end
1+ local M = {}
82
9- _G . _flash_esc_or_noh = function ()
3+ M . flash_esc_or_noh = function ()
104 local flash_active , state = pcall (function ()
115 return require (" flash.plugins.char" ).state
126 end )
@@ -17,7 +11,7 @@ _G._flash_esc_or_noh = function()
1711 end
1812end
1913
20- _G . _telescope_collections = function (opts )
14+ M . telescope_collections = function (opts )
2115 local tabs = require (" search.tabs" )
2216 local actions = require (" telescope.actions" )
2317 local state = require (" telescope.actions.state" )
@@ -45,7 +39,7 @@ _G._telescope_collections = function(opts)
4539 :find ()
4640end
4741
48- _G . _toggle_inlayhint = function ()
42+ M . toggle_inlayhint = function ()
4943 local is_enabled = vim .lsp .inlay_hint .is_enabled ({ bufnr = 0 })
5044 vim .lsp .inlay_hint .enable (not is_enabled )
5145 vim .notify (
@@ -55,7 +49,7 @@ _G._toggle_inlayhint = function()
5549 )
5650end
5751
58- _G . _toggle_virtuallines = function ()
52+ M . toggle_virtuallines = function ()
5953 require (" tiny-inline-diagnostic" ).toggle ()
6054 vim .notify (
6155 " Virtual lines are now "
@@ -66,7 +60,7 @@ _G._toggle_virtuallines = function()
6660end
6761
6862local _lazygit = nil
69- _G . _toggle_lazygit = function ()
63+ M . toggle_lazygit = function ()
7064 if vim .fn .executable (" lazygit" ) == 1 then
7165 if not _lazygit then
7266 _lazygit = require (" toggleterm.terminal" ).Terminal :new ({
@@ -82,7 +76,7 @@ _G._toggle_lazygit = function()
8276 end
8377end
8478
85- _G . _select_chat_model = function ()
79+ M . select_chat_model = function ()
8680 local actions = require (" telescope.actions" )
8781 local action_state = require (" telescope.actions.state" )
8882 local finder = require (" telescope.finders" )
@@ -110,3 +104,17 @@ _G._select_chat_model = function()
110104 })
111105 :find ()
112106end
107+
108+ M .picker = function (method , tele_opts )
109+ local prompt_position = require (" telescope.config" ).values .layout_config .horizontal .prompt_position
110+ local fzf_opts = { [" --layout" ] = prompt_position == " top" and " reverse" or " default" }
111+ if require (" core.settings" ).search_backend == " fzf" then
112+ require (" fzf-lua" )[method ]({
113+ fzf_opts = fzf_opts ,
114+ })
115+ else
116+ require (" telescope.builtin" )[method ](tele_opts )
117+ end
118+ end
119+
120+ return M
0 commit comments